Why I (mostly) Stopped Using input type="number"
Updated: 12th April 2026
Tags: html
I added type="number" to my admin panel years ago and never questioned it—until it caused a real bug.
While merging entities by ID, the value changed accidentally (instead 749 it became 750 - likely due to mouse wheel scroll), and I merged into the wrong record.
The issue
Most “numbers” in admin UIs aren’t really numbers:
- IDs
- Dates (day of month)
- Budget fields
- Codes
They’re not meant to be incremented.
But type="number":
- Changes on scroll / arrow keys
- Accepts weird values (
e,+, etc.) - Behaves inconsistently across browsers
- Can silently break validation
What I use instead
<input type="text" inputmode="numeric" pattern="[0-9]*">
Same mobile UX, no surprises, full control.
TL;DR
Use type="number" only for real, incrementable values (like quantity).
For everything else (IDs, etc.) → use type="text" with inputmode="numeric".