This Wiki page is edited by participants of the HTML Accessibility Task Force. It does not necessarily represent consensus and it may have incorrect information or information that is not supported by other Task Force participants, WAI, or W3C. It may also have some very useful information.

Input type numeric

From HTML accessibility task force Wiki
Jump to: navigation, search

Initial research from Mark RE: New input type "numeric"?

  • Had a conversation with someone recently who brought up U.S. zipcodes. They wanted to invoke the number keyboard on mobile and were considering using the input type number since US zipcodes consist entirely of numbers. On a desktop browser, UA's have started implementing a spin control to input the number and you can use min/max on it and it is implied that numbers will be used for calculation. However, while U.S. zipcodes are numeric, they are not a number (they can start with zeros) and will not be used in calculation.
  • I found a solution to this (at least in iOS) where if you use the pattern attribute and specify the value is [0-9] then iOS will present the user with a numeric keyboard.
  • There may still be a use case for a numeric type (much easier to invoke than using pattern for novice interface developers) and this has exposed another potential benefit of the pattern attribute, which is entirely custom keyboards, think about rendering a common calculator keyboard when using pattern="[0-9,+,\-\,/,*]"