Putting type="number" on a measurement field does not finish its validation. I ran into the distinction while reading the input flow for an inches-to-centimeters page: the browser's editing rules, Vue's model conversion, the arithmetic helper, and blur-time validation each handle a different part of the problem.
The conversion factor is not the difficult part. One inch is 2.54 centimeters. The interesting question is what the application should do while a user is clearing a field, entering a negative value, or trying to paste a fractional measurement such as “5 1/2.”
HTML Describes the Control, Not the Whole Domain
The fixed-pair component uses this input on its left side:
<input type = "number" v-model.number = "fromValue" class = "text-input" inputmode = "decimal" min = "0" step = "any" @blur = "validateInput('from')" />
Enter fullscreen mode
Exit fullscreen mode
Each attribute has a purpose. The number type gives the browser a numeric control.…