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

Faulty decimal separator behaviour when using the suffix prop. #673

Closed
3 tasks done
fullyCommitted opened this issue Sep 21, 2022 · 1 comment
Closed
3 tasks done

Comments

@fullyCommitted
Copy link

fullyCommitted commented Sep 21, 2022

Describe the issue and the actual behavior

Example usage:

<NumericFormat
  type="text"
  allowNegative={false}
  valueIsNumericString={true}
  decimalScale={8}
  placeholder="Enter Amount"
  suffix=" USD"
  value={input}
  onValueChange={(values) => {
    setInput(values.value);
  }}
/>

If you enter the . character, it will leave the cursor before the dot and not after. So you'll be inputing whole numbers still, unless you use the mouse or arrow keys to navigate after the separator.

Removing the suffix prop fixes this issue.

Describe the expected behaviour

Inputing the decimal separate should leave the cursor after the separator.

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/s/hardcore-rgb-cmgb6f?file=/src/App.js

Provide steps to reproduce this issue

See codesandbox.

Please check the browsers where the issue is seen

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

s-yadav commented Sep 23, 2022

Looks like a bug. Will check.

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