6 ms·
> But you appear to have confused the article section titled "Accessibility" with the concept of accessibility. I mean. Yeah - I guess I expect the section nam
by peterangular 4y ago
> But you appear to have confused the article section titled "Accessibility" with the concept of accessibility.
I mean. Yeah - I guess I expect the section named "Accessibility" to be about the concept of accessibility.
---
> Values in a number input are automatically rounded or even converted to exponential notation by the browser. Because while it might look like your credit card number is 4000 0566 5566 5556, what you want to put into the form is 4.000056655665556e+15
So, just like a telephone number - CC #'s are not technically numeric as they're more accurately thought of as a "sequence of numbers"... and funnily enough many people will sorta hijack the functionality of the <input type="tel"> using "pattern" and other attributes to input them correctly.
Whatever the case is, it is considered a bad practice to use type="number" for a CC field. type="number" specifically is for when a field is a numeric "value" - this is not the case with a CC number as it's a sequence of digits (as-in the value of the digits doesn't mean anything).
Your point is valid for very large numbers, or numbers with incredible precision. Sometimes yes, those extreme values can cause weird non-intuitive behavior from the number field. While I have ran into these use cases, I 100% consider them to be edge. Most people aren't inputting numbers that large into an application; and it can actually be considered a bad UIX practice (ex: making someone enter a large value in bytes vs. smaller value scaled in gigabytes).
---
> Yep, Safari 5.1 is old. It was also old in 2020. Doesn't make this less of a disaster for users on Safari 5.1
So, Safari is on 15 and according to https://caniuse.com/usage-table https://caniuse.com/usage-table it is 0.02% the market share.
Every time we create software targeting the browser as a presentation layer we have to ask ourselves what the acceptable market cut-off for browser support is. This is largely dictated by the nature of the software, who is using it, geographies... lots of things.
Unless the solution warranted, or the client demanded incredible backwards compatibility, I would not shackle myself to supporting browsers with that low of a current use %. The economics for my time, vs. what I would sacrifice in capability just do not work out. Also, I don't have the scale of Facebook or Google where I need to support... everything. 99.9% of the time I just need to support reasonably modern browsers 3-4 major versions back.
---
> It's not hard to run into the mousewheel issue. I've run into it on multiple occasions. It is not necessary to dispatch mouse events to child elements - anyone who clicks on the input element to focus there has now positioned their cursor directly over the input element.
Although browsers differ in how they handle value changing on scrolling for number fields (Chrome: no change, FF: value changes), I don't think it's outside of the realm of expected functionality...
Similarly, if you click on a dropdown element gives it focus, scrolling the mouse wheel the dropdown will select different options; even if the cursor isn't directly over it. The same is true with other inputs, my cursor is not on this <textarea> but I am still able to type within it because it has focus. It will not lose focus unless I click off of it.
I sorta get how this behavior doesn't translate well for the number field. I will note you can easily stop the behavior with onscroll="return false" attribute or a JS event listener with event.preventDefault() ... I've seen both in the wild and they're fine solutions. Even for no-JS users I think it's still OK since they've consciously opted-in to the default browser behavior for stuff like this.
But still - it's not completely outside of the realm of unexpected behavior for an input to still react to scroll if it the element has focus. And, if it's a problem it's incredibly easy to fix and still get all of the accessibility benefits that a number field offers.
---
> You need to do some real testing
I find this aggressive.
Although you have clearly decided I haven't... I have. I just think people making real arguments against the using numeric input elements is off. I've used them for years now without encountering the edge cases people are throwing out there; and, I still find using the 2020 GOV.UK site as basis against the use is problematic. I think often it's more accessible to use them when appropriate, even given the quirks we've discussed.
I've shared my thoughts - feel free to rebut for others to read, but I'm fully done conversing on this with you.
- thaumasiotes 4y agoSure, in no particular order: >> You need to do some real testing > I find this aggressive. > Although you have clearly decided I haven't... I have. I just think people making real arguments against the using numeric input elements is off. I've used them for years now without encountering the edge cases people are throwing out there I don't have users. But I do run into problems with number inputs in the ordinary course of my personal life. I tend to suspect that's related to this observation of yours: > browsers differ in how they handle value changing on scrolling for number fields (Chrome: no change, FF: value changes) But if professional testing can't turn up a problem so common that the internet is full of warnings and complaints about it... something's wrong with the testing. --- > I sorta get how this behavior doesn't translate well for the number field. I will note you can easily stop the behavior with onscroll="return false" attribute or a JS event listener with event.preventDefault() ... I've seen both in the wild and they're fine solutions. The idea that these are "solutions" conflicts with the idea that the behavior isn't a problem to begin with. > Even for no-JS users I think it's still OK since they've consciously opted-in to the default browser behavior for stuff like this. I can't agree with that; rather, this is a cost they pay, generally without even being aware of the particular functionality, in order to prevent JavaScript from doing nasty things to them. The idea that if they don't want to be abused by your JavaScript, they deserve to be abused by your passive-aggressive HTML design is... strange. --- > So, Safari is on 15 and according to https://caniuse.com/usage-table https://caniuse.com/usage-table [5.1] is 0.02% the market share. I tend to agree with you here. Safari 5.1 is too rare to be worth much attention. But you placed heavy emphasis on the idea that the reasons the UK article gives for avoiding number input types are outdated, and they aren't. Safari 5.1 is not meaningfully older now than it was two years ago. Number input behaves no better now than it did two years ago. --- > I mean. Yeah - I guess I expect the section named "Accessibility" to be about the concept of accessibility. That section is focused on the jargon meaning of "accessibility" as "making it easier for disabled people to use [whatever]". But there is no reason for "accessibility" to be the exclusive province of the blind - "people with mice" have concerns too. (Even there I'm being too generous - as with other forms of idealized equality, you can see misguided pushes to achieve equality by making [whatever] worse for everyone, as long as the new lower quality is equal for normal people and disabled people. And I can't really see another way to interpret advocacy of number input - you want to make your website less accessible to everyone on the theory that a small number of people might not suffer a relative disadvantage in using it. Don't do that.) ----- Number input is designed badly enough that MDN, and the HTML spec, both warn you that you probably want something else. That should be a hint that you want something else. Use the tools that were developed to provide the good things that number inputs provide, without also doing the terrible things that number inputs do.