[Proposal] keyboard type attribute for input fields

#1

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
0 Likes

#2

Take a look at the inputmode attribute.

0 Likes

#3

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

0 Likes

#4

Can you provide more on an example here?

0 Likes

#5

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.

0 Likes

#6

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.

0 Likes