News for hackers. Stuff that matters.
Re:The number input is the worst input by IlliOnato on Friday September 16, 2022 @02:22AM (#32862759)
Hmm. The author's problem is not with <input type=number> conceptually, which would be fine if properly supported by browsers, i.e. in the ideal world.

In the real world, however, the browsers apparently a) don't prevent users from entering incorrect values b) don't allow the developer to do anything about it programmatically, by preventing access to these incorrect values (always returning empty).

The author brings attention to this problem.

Now it's up to you as a developer to decide whether the benefits of using <input type=number> outweigh the costs, but the costs are real and you need to be aware of them.

Re:The number input is the worst input by runarberg on Friday September 16, 2022 @01:00PM (#32868964)
It is supported by all modern browsers. Even IE-11 supports valueAsNumber and the most important Constraint Validation API methods to deal with the problems the author mentions.

If you want to deal with inconsistent (and possible eccentric) user input: Use input.valueAsNumber

If you want to distinguish between empty and invalid inputs: Use input.validity.valid or input.validity.badInput

If you want to programmatically deal with incorrect entries: Again use the constraint validation API.