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

allow -0 at NumberInput filling #8626

Closed
wants to merge 5 commits into from

Conversation

pamuche
Copy link
Contributor

@pamuche pamuche commented Feb 7, 2023

Problem

If you want to enter a negative number <1 (e.g. -0.14) <NumberInput/>-onChange automagically corrects -0 to 0 while typing. You can add the - after a not-0-number (e.g. 0.14) is filled in .

Solution

Adding special -0 input treatment in convertStringToNumber.

@pamuche pamuche changed the title allow -0 at NumberInput filling Draft: allow -0 at NumberInput filling Feb 7, 2023
@pamuche pamuche marked this pull request as draft February 7, 2023 10:11
@pamuche pamuche changed the title Draft: allow -0 at NumberInput filling allow -0 at NumberInput filling Feb 7, 2023
@fzaninotto
Copy link
Member

fzaninotto commented Feb 7, 2023

I can't reproduce the bug you're describing with the latest version (4.7.4):

numberinput.mov

Can you include a way to reproduce the bug, or even better, a unit test that fails in master and passes with your patch?

@pamuche
Copy link
Contributor Author

pamuche commented Feb 7, 2023

Yes, I was confused, that it was working in storybooks.

Here is a screencast from the poster galore demo, where it won't work:

Peek 2023-02-07 14-30

I will check again. and look into unit testing react-admin.

@fzaninotto
Copy link
Member

The Posters Galore demo hadn't been updated in a few weeks, and the fix is recent (#8610). That explains why you had the bug there.

I've updated the Posters Galore demo, and I don't see the bug anymore.

@pamuche
Copy link
Contributor Author

pamuche commented Feb 8, 2023

💯 👍 Yes this will fix my problem. Hrnks, sorry for bothering you. But also thanks for the kind help. ☝️ Will update before my next PR. ☝️ 😁

@pamuche pamuche closed this Feb 8, 2023
@pamuche pamuche deleted the allow_negative_0 branch February 8, 2023 09:46
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

Successfully merging this pull request may close these issues.

2 participants