react-numeric-input
react-numeric-input copied to clipboard
Min value is not respected
When the min value is reached, the UI goes bellow the min. When the cursor/focus moves away from the input, the value is automatically adjusted to min, but no change event is sent.
Couldn't it be normed at min & max ?
For this definition:
<NumericInput
min={1}
max={1000}
value={23}
step={10}
snap
/>
It allows descending to 0 (when using the UP/DOWN arrows) but then, when focus is lost, it goes back to 1 and for that 1 value it takes, it wont trigger a change anymore one cannot reliably get the the value when minimum is reached.
I have added a demo here https://codesandbox.io/s/k28lwmq105
I have a similar issue: when you define min={10} max={2000} and then I select the entire input and press "3" The value stays as it is - without the minimum value restriction. Happened to me on the latest online demo when I configured the above min & max restrictions
I have a similar issue: when you define min={10} max={2000} and then I select the entire input and press "3" The value stays as it is - without the minimum value restriction. Happened to me on the latest online demo when I configured the above min & max restrictions
I've also been struggling with this - particularly since on the live demo page the 'Typical Usage' example works fine i.e. entering a value < 0 or > 100 causes it to auto-correct to the nearest valid value on blur.
From what I can tell the problem lies with the precision setting - if you don't set that prop it all seems to work as intended.
Annoyingly even when taking the precision setting out of the equation it still doesn't really work (in a useful way) because when the onChange event fires it passes the invalid value.
And, even though the component updates to a valid value on blur, it doesn't fire another onChange event until it receives focus again.