A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members) or send an e-mail to admin@wiki.whatwg.org with your desired username and an explanation of the first edit you'd like to make. (Do not use this e-mail address for any other inquiries, as they will be ignored or politely declined.)

Text input keyboard mode control

From WHATWG Wiki
Jump to: navigation, search

See also http://www.w3.org/Bugs/Public/show_bug.cgi?id=12885 and http://www.w3.org/Bugs/Public/show_bug.cgi?id=12409 and yet another CSS proposal — 'input-mode'. Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=746142

Existing kinds of keyboards



  • Telephone number input
  • Numeric input
  • E-mail address input
  • Text input

(Images hotlinked from this StackOverflow post: http://stackoverflow.com/questions/773843/iphone-uiwebview-how-to-force-a-numeric-keyboard-is-it-possible )


  • Text input with leading capitalisation
  • Username / password input? (no capitalisation)
  • Text input without capitalisation in a search context (search submission button)
  • Numeric input (big 0-9 keys, +, -)
  • Telephone number input (big 0-9 keys, *, #)
  • URL input (keys for /, "www.", ".com")
  • Email input (keys for @, '-', ".com")


Android Japanese keyboards

Four basic modes:

  • kana input [あ]
  • roman-alphabet input [A]
  • number input [1]
  • symbol input [☺ or (^_^)]

Here are three examples of kana mode, using respectively the ATOK, Google, and Samsung IMEs on Android:

ATOK IME Google IME Samsung IME

Mac OSX Japanese keyboard switching

Five basic modes:

  • Hiragana
  • Katakana
  • Half-width Katakana
  • Half-width Alphanumeric (normal way, as with standard Roman/English keyboard)
  • Full-width Alphanumeric (characters are double-width of normal Roman/English characters)

The following screen capture shows the case for keyboard options on a Mac OS X system with two different Japanese IMEs installed. One (called Kotoeri) is the standard built-in Japanese IME that ships with OS X (the options with gray/back icons shown in the menu). The other is Google Japanese IME (the options with blue icons shown in the menu).

Mac OS X keyboard switcher

Existing APIs


XForms uses a model of modifiers ("startUpper", "predictOff", "digits", etc) and script block names ("simplifiedHanzi", "tagalog", "canadianAboriginal", etc).

Example: http://www.w3.org/TR/xforms/#mode-examples

Proposed APIs


  • 'numeric': 0-9, +, -, comma, dot;

Use case: to have a vkb similar to <input type='number'> without the UI and other stuff that come with <input type='number'>. That could be used for other stuff than numbers for example.

  • 'digit': 0-9 only;

Use case: to write digits without being numbers like social security number or credit card number.

  • 'uppercase': A-Z only;

Use case: obvious, could even be used on desktop.

  • 'lowercase': a-z only;

Use case: obvious, could even be used on desktop.

  • 'titlecase': uppercase character for each new word;

Use case: obvious, could even be used on desktop.

  • 'autocapitalized': first letter is uppercased;

Use case: obvious, could even be used on desktop. Also, that would be a parity feature for iOS autocapitalized attribute.

Except 'number' it's not obvious that we should have input modes similar to input types (like email, tel, url). Actually, we could even discuss the use case of 'number'.
This is intended to be a small set of quite obvious input modes. Some other might be useful.

Ian Hickson

These are arranged in a tree shape. A user agent only has to support one input method, the default input method, which is the root of the tree. It may support any of the others listed; if one is requested by an author, then the user agent should use it, or the nearest ancestor in the tree that it supports (i.e. fallback up the tree).

  • User Default Input Method
    • Latin text verbatim (usernames, passwords)
      • Latin text with prediction and capitalisation (for communication with other humans: chat, e-mail subject or body, etc)
        • Latin text with prediction but no capitalisation (for communication with computers: search, programming, etc)
          • Full-width latin text with prediction and capitalisation (for communication with other humans in an otherwise CJK context)
    • Hiragana text, with support for upconversion to Kanji (Japanese input)
      • Katakana text, with support for upconversion to Kanji (Japanese input)
        • Half-width katakana text (Japenese input)
    • Numeric input (e.g. times; includes key for thousands separator and - key)
      • Telephone number input (includes * and # keys)
    • E-mail address input (includes @ key)
    • Web address input (includes / key)