Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix/Suffix containing numbers gets appended to value #694

Closed
3 of 6 tasks
bjosttveit opened this issue Oct 19, 2022 · 1 comment
Closed
3 of 6 tasks

Prefix/Suffix containing numbers gets appended to value #694

bjosttveit opened this issue Oct 19, 2022 · 1 comment

Comments

@bjosttveit
Copy link

Describe the issue and the actual behavior

In NumericFormat, if using a suffix containing numbers, and you select/place the cursor at the end and type a number, the numbers in the suffix gets appended to the value. For example, using the suffix 000 USD denoting thousands of dollars, and a value of 1 resulting in the text 1 000 USD, you can select USD and type 1, which will result in the zeros getting appended to the value giving 10001 000 USD.

Additionally, if you instead try typing any non-numeric character, it will also append the zeros resulting in 1000 000 USD when the value should not change at all.

This also applies to prefixes when the order is reversed e.g. USD 000 .

Describe the expected behavior

In the above example the expected behaviour when typing a number like 1 would be that the value becomes 11, and that the text becomes 11 000 USD. Alternatively blocking the input entirely. When typing a non-numeric character, the expected behaviour is that the input is blocked.

This issue was not present in version 4.9.4, in this version the input was blocked in this case.

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/s/suffix-issue-i0tlk7?file=/src/App.js

Provide steps to reproduce this issue

In the sandbox linked above:

  1. Select USD by double clicking.
  2. Type any number, any non-numeric character, or backspace.

Please check the browsers where the issue is seen

  • Chrome
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)
@s-yadav
Copy link
Owner

s-yadav commented Mar 5, 2023

Fixed on v5.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants