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

5.3.1 Regression: Typing "." leads to "^0.00" where "^" is location of caret #817

Closed
2 of 6 tasks
Stan-Stani opened this issue Dec 15, 2023 · 1 comment
Closed
2 of 6 tasks

Comments

@Stan-Stani
Copy link

Stan-Stani commented Dec 15, 2023

Describe the issue and the actual behavior

Typing "." then "5" in an empty input leads to "50.00" with a controlled input in version 5.3.1 but not 5.3.0

glitchNumberInput

<NumericFormat
          // defaultValue={"0.00"}
          autoComplete="off"
          fixedDecimalScale
          decimalScale={2}
          onValueChange={(obj, objtwo) => {
            console.log(obj);
            setValue(obj.value);
          }}
          value={value}
          allowNegative={false}
          allowLeadingZeros={false}
        />

Describe the expected behavior

Above input should lead to "0.50" or ".50"

Using defaultValue for my case is not preferred because it's easier to just click in an empty input
than to position the cursor at the beginning of the default value.

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/p/sandbox/value-demo-forked-8jrtyg?file=%2Fsrc%2FApp.js%3A18%2C29

Provide steps to reproduce this issue

See above description

Please check the browsers where the issue is seen

  • Chrome
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)

Edit: Also note that if the version is pinned to 5.3.0 and valueIsNumericString is present, then the same issue presents itself.

@Stan-Stani Stan-Stani changed the title 5.3.1 Regression: Typing "." leads to "^0.00" where caret is at location of ^ 5.3.1 Regression: Typing "." leads to "^0.00" where "^" is location of caret Dec 15, 2023
connor-baer added a commit to sumup-oss/circuit-ui that referenced this issue Jan 8, 2024
@s-yadav
Copy link
Owner

s-yadav commented Feb 25, 2024

This is fixed on 5.3.2

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