Brad Frost wrote about a recent experience with a website that used <input type="number">
:
Last week I got a call from my bank regarding a wire transfer I had just scheduled. The customer support guy had me repeat everything back to him because there seemed to be a problem with the information. “Hmmmm, everything you said is right right except the last 3 digits of the account number.”
He had me resubmit the wire transfer form. When I exited the account number field, the corner of my eye noticed the account number change ever so slightly. I quickly refocused into the field and slightly moved my index finger up on my Magic Mouse. It started looking more like a slot machine than an input field!
Brad argues that we then shouldn’t be using <input type="number">
for “account numbers, social security numbers, credit card numbers, confirmation numbers” which makes a bunch of sense to me! Instead we can use the pattern attribute that Chris Ferdinandi looked at a while back in a post all about constraint validation in HTML.
It's worth mentioning that numeric inputs can be more complex than they appear and that their appearance and behavior vary between browsers. All good things to consider along alongside Brad's advice when evaluating user experience.
Also:
<input inputmode="numeric"> is the way forward for mobile numeric keyboards (paired with `pattern="[0-9]*"` on iOS pending inputmode support).
Note: positive integers only!https://t.co/R9WuwXy106 https://t.co/2HiSq4ZXK0
— Zach Leatherman (@zachleat) March 25, 2019
Direct Link to Article — Permalink
The post You probably don’t need input type=“number” appeared first on CSS-Tricks.
from CSS-Tricks https://ift.tt/2TSiaYG
via IFTTT
No comments:
Post a Comment