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

Number input returns empty value when user enters Dot #3038

Open
jaikumar-tj opened this issue Jan 13, 2025 · 0 comments
Open

Number input returns empty value when user enters Dot #3038

jaikumar-tj opened this issue Jan 13, 2025 · 0 comments

Comments

@jaikumar-tj
Copy link
Contributor

Describe the bug

When user enters decimal numbers eg: 1.5, the onChange callback of NumberInput component intermittently returns empty value.

This is causing issue for Set-number fields which was implemented in MC-frontend (experimental component).
The Set fields works based on total number of values present and ignoring any empty values. When the user inputs . (dot) then the onChange returns empty value which is causing the Number input in the UI to disappear.

https://commercetools.atlassian.net/browse/PDM-5

JFYI: @bradd123 & @ismaelocaramelo have some ideas for how it could be done by UI Kit.

Steps To Reproduce

  • Goto product detail page which has set-number (eg: Attribute SET-NUMBER SameForAll )
  • Click on the plus icon to add a new number input
  • Enter a floating number with dot (eg: 2.5)
  • Notice the newly added number input disappeared
Screenshot 2025-01-13 at 18 42 18

Expected behavior

  • If possible, I would expect the onChange to return the dot along with number 1.
  • If that is not possible then it would be better if we append zero and return 1.0
  • If you have any other solution to this issues, please let me know.
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

1 participant