A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] keyboard type attribute for input fields

sbaechler
2019-02-17

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
simevidas
2019-02-23

Take a look at the inputmode attribute.

sbaechler
2019-02-24

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

briankardell
2019-02-24

Can you provide more on an example here?

simevidas
2019-02-24

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.

jhpratt
2019-02-24

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.