-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
InputNumber: Doesn't allow minus sign in currency mode #4875
Comments
…in currency mode
…in currency mode
…in currency mode
…in currency mode
…y mode (#4881) * Fix primefaces #4875 InputNumber: Doesn't allow minus sign in currency mode * Fix primefaces #4875 InputNumber: Doesn't allow minus sign in currency mode * Fix primefaces #4875 InputNumber: Doesn't allow minus sign in currency mode * Fix primefaces #4875 InputNumber: Doesn't allow minus sign in currency mode * Update components/lib/inputnumber/InputNumber.js Co-authored-by: Melloware <[email protected]> --------- Co-authored-by: akshayaqburst <[email protected]> Co-authored-by: Melloware <[email protected]>
Hi. Does the solution fix the problem when I can't remove negative value from the field? |
@akshayantony55 can you test the above scenario? |
@melloware Where can I test the recently merged changes? |
just do a git pull from |
@melloware |
Seems there is a typo with the suggested code. I will create a new PR soon. |
@VasiliPodoplielov If the value is invalid, it cleans the input field. Thats an expected behaviour. |
@akshayaqburst |
…in currency mode
@melloware I have fixed the typo issue with the previous PR and also added the ability to remove - sign as requested by @VasiliPodoplielov. |
it should not be. What was the last version that worked. To me it should NOT take characters. |
@VasiliPodoplielov can you update my reproducer to show the issue? https://stackblitz.com/edit/react-fv1wob?file=src%2FApp.js I can't reproduce so can you show me your exact settings that make it happen. |
OK there are bigger issues here I need to investigate. |
OK I think I got all the issues. only 1 minus sign. BACKSPACE works to remove the minus sign. It goes in the correct place etc. |
@melloware looks great. Sorry, when these changes will be available to use? |
Thanks for testing! I think 10.0.0 is due out next week |
Describe the bug
Hello.
I faced problem in InputNumber when I use this component like this:
<InputNumber mode="currency" currency="USD" />
It uses
prefix
in input under the hood. So the problem is related not only to thecurrency
mode but also when I use any prefix.When I populate some value to the field and after that want to make this value negative by adding
-
minus sign - it happens nothing. After some investigation I found out that problem might be related to this part of code:because
selectionStart=1
,prefix
has a position 0 and minus sign should be on -1 position.Another problem, when I have a negative value with prefix inside an input, e.g.
-$123
I cant remove value from input by pressingbackspace
. I need highlight the whole value and after that pressbackspace
ordelete
button.Reproducer
https://codesandbox.io/s/primereact-demo-forked-pj7tdw?file=/src/App.js
PrimeReact version
9.6.2
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
It should be possible to add minus sign when cursor is at the start(before the number).
It shuold be possible to remove negative number by pressing
backspace
.The text was updated successfully, but these errors were encountered: