s-yadav / react-number-format

React component to format numbers in an input or as a text.
MIT License
3.87k stars 409 forks source link

Weird behavior after clearing input #855

Closed MartinWeb closed 1 month ago

MartinWeb commented 2 months ago

Describe the issue and the actual behavior

When we clear a NumericFormat input, either with the Suppr button directly by testing, either with the clear function of the userEvent of testing-library, a weird behavior appears with the last version, the 5.4.1. This didn't use to happen with the 5.4.0.

After clearing the input, when we start typing, the first number are set as floating numbers, not as "positive" numbers like it used to.

Describe the expected behavior

Provide a CodeSandbox link illustrating the issue

Provide steps to reproduce this issue

Here on the gif, i focused the input, Ctrl + A to select all, click Delete button, then type 3.21. The 3 number appears, then disappear after clicking the . firefox_p4Mse8jbLQ

I have these properties set on the NumericFormat component decimalScale="2" decimalSeparator="," fixedDecimalScale allowNegative={false}

Please check the browsers where the issue is seen

s-yadav commented 1 month ago

This is fixed on 5.4.2.