Closed selfthinker closed 7 years ago
The pattern
attribute forces numeric keypads on iOS devices. Having just tried it, type=number
alone does not force the numeric keypad.
For other types of numbers, type=number
isn't appropriate and type=text
should be used. For dates it's probably fine though.
Agree should probably add some documentation.
@hannalaakso anything to add?
Here's a blog post about the different iOS keypads when you add or omit the pattern attribute on number inputs: http://bradfrost.com/blog/mobile/better-numerical-inputs-for-mobile-forms We are looking to create guidance on choosing the most appropriate input and pattern for different use cases involving numbers.
Agree that adding a note about the invalid HTML is a good idea.
The date form example uses invalid HTML. The W3C Validator says:
It was added in #47, and I believe it was done to make sure the number keyboard shows up in some devices -- at least at the time.
We should find out if it's still necessary, and if it is, we should add some kind of documentation somewhere that the invalid HTML is intentional.