Open
Description
Bug report
Current behavior
If you enter a value, say "1.23456"
, which would be truncated by formatNumber
, onValueChange
gets called with 1.23456
, and the input text is set to e.g., "1.234".
The next time you focus and blur, onValueChange
is called with 1.234
, despite the user not having input.
Expected behavior
Up for discussion, but IMO focusing and blurring an input should not change the underlying value.
Reproducible example
https://codesandbox.io/p/sandbox/base-ui-number-input-blurring-xj5xsd
Base UI version
1.0.0-alpha.8
Which browser are you using?
Edge
Which OS are you using?
Windows
Additional context
In my personal number input component, to avoid this, I'm just roundtripping the value before calling onValueChange
, so you do user input -> value -> formatted text -> value
. Currently it's doing user input -> value
and value -> formatted text
separately.