No More Numbers
HTML5 number inputs aren't useful, but tel inputs, have all the power
Introduction
HTML5 Number inputs have been the bane of my existence since they have come out. They are the standard field for when expecting a number, be it an integer or a floating point number, and have been implemented: to show a numeric keyboard with on screen keyboard devices, to be able to be configured with a maximum and minimum, and with an ability to step the number up and down a set step value.
Outside of these features however, lies the dark side of the input. Enter a valid number and all is hunky dory. Enter a invalid value however, and you get '' — zip, nada, nothing, blank. No way to check if it is almost valid or to try and correct it.
There are partial solutions, such as using the pattern attribute on text inputs. This however, does not give numeric keypad on Android and depending on the pattern, gives the number and symbol keypad on iOS devices.
The closest I could find to what I wanted was the telephone input type.
2026 Update
Well. Things haven't changed much at all. The only difference from 2019 is we now have the inputmode attribute, so you don't need to set the type to tel.