News for hackers. Stuff that matters.
Re:You probably don’t need input type=“number” by thaumasiotes on Sunday March 24, 2019 @11:52PM (#19480203)
As far as I can tell, a spinbox interface is not appropriate in any circumstance, even when your semantics are unambiguously numeric. This is mentioned in the article too: "Dammit! I wanted to buy two pairs of socks, not 39."

A spinbox only makes sense if you don't care what the value is, such that any two nearby values are exactly equivalent. And that is what the W3 guidance you quote says:

> Getting a credit card number wrong by 1 in the last digit isn’t a minor mistake, it’s as wrong as getting every digit incorrect. [And that's why a card number field should not use a spinbox.]

This suggests to me that the real problem is the idea that "type=numeric" means you want a spinbox. You don't ever want a spinbox; there's no reason for any attribute to give you one. But you frequently do want to restrict the input to numeric characters.

Mouse-adjustable low-resolution analog values have their own widget, the scrollbar. If you somehow find yourself wishing for a spinbox, use one of those.

Re:You probably don’t need input type=“number” by beatgammit on Monday March 25, 2019 @12:38AM (#19480326)
When I'm doing game dev or 3d modeling or something, I often don't care what the values are, I just spin a bit until they look good. The same goes for angles that aren't on a labeled unit circle, percentages, and most other numbers that can reasonably be >30 or so.

Basically, if "close-ish" is acceptable, then a numeric input makes a ton of sense. And that's the case for lots of things, and most of those things wouldn't be entered with a keyboard (unless you want to get the figure in the ballpark).

If the number is <10 or so most of the time, then a menu makes a ton of sense (number of socks), and include a "custom" option so users can enter their own numbers. I do this with all kinds of things that only need a ballpark number but don't benefit from tweaking (e.g. seconds in an internal; basically, if 10 options or so makes sense, just make it a menu).

I happen to work with graphical things that don't need to be precise much of the time but need more precision that a set of presets. But most retail and whatnot apps are not that.

Re:You probably don’t need input type=“number” by thaumasiotes on Monday March 25, 2019 @12:55AM (#19480377)
> that's the case for lots of things, and most of those things wouldn't be entered with a keyboard

I agree with that, but this is an attribute of a text entry field. Like I said, we already have a different widget that accommodates the "I don't care what the value is, but I want to be able to easily fudge it upwards or downwards" use case.

Re:You probably don’t need input type=“number” by zeroimpl on Monday March 25, 2019 @09:42AM (#19482313)
Is there an <input type=“scrollbar”/>?

Also, input does not necessarily mean text entry. We have <input type=“checkbox”/> and <input type=“button”/> among others.

Re:You probably don’t need input type=“number” by yorwba on Monday March 25, 2019 @09:49AM (#19482357)
I'm not sure what you mean by "scrollbar" input, but maybe <input type="range"> fits?
Re:You probably don’t need input type=“number” by dahart on Monday March 25, 2019 @10:23AM (#19482608)
That’s not what the W3 line you quoted is saying, you’re conflating two different things. The W3 guidance is making a distinction between numeric values and identifiers that happen to use all digits; it’s a semantic difference.

Some people do like spin boxes, and they allow you to adjust numeric values without reaching for the digit row on your keyboard. By all means, don’t use them if you don’t like them, but they do exist for a reason.

Whether spinboxes are good UI is a separate debate.

Re:You probably don’t need input type=“number” by michaelmior on Monday March 25, 2019 @11:20AM (#19483264)
Why wouldn't I want a spinbox for something like product quantity? I didn't really understand the example in the article. I get that it doesn't help if I mistype 39 when I meant 2, but is helpful in other cases.

If I'm not mistaken, using type="pattern" also means I can't use min or max.