[Proposal] keyboard type attribute for input fields

Touch devices usually display a keyboard that fits the input type. E.g. <input type="tel"> would trigger the phone keyboard.

Unfortunately implementations of alternative input fields are inconsistent across browsers and developers often have to fall back to text inputs.

Another case where text inputs are required is if the values were to be formatted, even if the field only accepted number values.

A new attribute on input fields could explicitly state the best on-screen keyboard type for that field.

Example keyboards are:

  • Text
  • Alphanumeric
  • Numeric
  • Phone
  • Email
  • Date
  • Time
  • Datetime
  • Emoji

Take a look at the inputmode attribute.

Oh, wow. I have never heard of this. Do you know why it is considered obsolete by the W3C?

Can you provide more on an example here?

It was removed in 2017 because there were no implementations. It seems that Chrome has shipped it in 2018. So this feature seems to have been revived.

I believe what they’re trying to say is situations such as currency, when you’d want it to be in the format of $X,XXX, even though the only valid values are numbers.