Explore numeric input problems
Seven ways a numeric input breaks in a web app. Try each demo, then you'll see why Numora exists.
Paste chaos
Users paste numbers in whatever format they have
Real users paste values from spreadsheets, financial reports, different locales, and scientific tools. Native inputs reject them or corrupt the value without telling you. Press a paste button to see it.
Cursor position hell
Formatting moves the cursor
Add commas to a number as it is typed and the cursor jumps to the end. Type 1234567 quickly in both inputs and watch the cursor.
Type rapidly and watch the cursor jump to the end after each keystroke:
Cursor at position: 0
The cursor jumps to the end every time, so you can't edit the middle.
Type quickly. The cursor stays where it belongs:
Cursor at position: 0
The cursor stays put, even as Numora adds commas.
Scientific notation expansion
1e-18 should expand to 0.000000000000000001
DeFi amounts are often very small or very large. Pasting 1e-18 (1 wei) should show the full decimal, not scientific notation.
1e-180.0000000000000000011.5e-70.000000152.1e+152100000000000000Native value:
(empty)Shows scientific notation or loses precision
Numora expands:
(empty)Full decimal expansion, no precision lost
Mobile keyboard gremlins
Invisible characters that break validation
Mobile keyboards can insert non-breaking spaces (U+00A0), zero-width characters and other invisible Unicode. Validation and math then fail with no visible cause.
When copying "1 234" from a mobile app, you might get:
What you see:
1 234What's actually there (UTF-8 bytes, hex):
31 C2 A0 32 33 34(C2 A0 = UTF-8 non-breaking space)
The decimal dilemma
Is 1,234 one thousand or 1.234?
In the US, 1,234.56 means one thousand two hundred thirty-four and 56 cents. In Europe, the same number is written as 1.234,56. A native input can't tell which one you mean.
Try typing 1.2.3.4 or1,2,3,4 to see what happens with repeated separators.
Valid for US:
1,234.56Confusing for US:
1.234,56Type 1,234.56:
A native input rejects commas and has no locale setting.
Type 1,234.56:
You set the decimal separator. Numora keeps the first decimal separator and drops the rest.
Thousand separator traps
Format on blur is jarring. Format on change is hard
Adding thousand separators while someone types is hard. Most implementations format on blur, which jars, or on change, which moves the cursor. Regions also group digits differently.
Type 1234567 and watch the cursor:
Problems:
- Cursor jumps to end after each keystroke
- Editing in the middle is impossible
- Only supports one grouping style
Type 1234567 the same way:
Features:
- The cursor stays in place
- You can edit anywhere in the number
- Supports Thousand grouping: 1,234,567
The type="number" lie
It looks right, but it isn't
<input type="number"> looks like the obvious choice for a numeric input. It has problems that make it a poor fit for money.
Scrolling over the input changes the number
It rejects thousand separators
Increment and decrement buttons show up
Allows "e" but not ","
Screen readers handle it inconsistently
Some mobile browsers show the wrong keyboard
.value can differ from the text on screen
Hover over the input and use your scroll wheel:
- Hover and scroll to change the value by accident
- Try typing 1,000 (comma rejected)
- Look at the spinner buttons
Implementation:
<input type="number" />Same test. Hover and scroll:
Numora uses:
- type="text", so scrolling does nothing
- inputmode="decimal" for the numeric keyboard on mobile
- Commas and other separators
- Numora sanitizes pasted values before they reach your state
Implementation:
<input type="text" inputmode="decimal" />Fix these in your app
Numora handles every case on this page. Values stay strings, so nothing loses precision, and the cursor stays where you left it.