primefaces / primefaces/primereact
InputNumber: "-" sign on empty input is ignored
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When the InputNumber field is empty, focusing it and pressing the minus (-) key to enter a negative number causes 0.00 to be inserted automatically, and the caret jumps to the end of the input. As a result, it's impossible to enter a negative value directly. The user must first select and delete the entire 0.00 value and only then can enter a negative number.
I know that It worked correctly in PrimeReact v10.8.4.
Reproducer
https://codesandbox.io/p/sandbox/6h56ml
System Information
System:
OS: macOS 26.5
CPU: (10) arm64 Apple M4
Memory: 71.41 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.19.4 - /Users/{{username}}/.nvm/versions/node/v20.19.4/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.8.2 - /Users/{{username}}/.nvm/versions/node/v20.19.4/bin/npm
Browsers:
Brave Browser: 147.1.89.132
Chrome: 148.0.7778.216
Firefox: 149.0.2
Safari: 26.5
npmPackages:
primereact: 10.9.8 => 10.9.8
react: 18.3.1 => 18.3.1
Steps to reproduce the behavior
- Open reproducer. There will be an empty number input.
- Focus it and type "-"
Actual result: "0.00" appears in the input, caret stays in position after the decimal point
Expected behavior
"-" should be displayed in the input, caret stays at the end of the input
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproducer and the PrimeReact InputNumber implementation, focusing on the empty-input path when the minus key is pressed. Confirm that the field keeps the '-' and the caret remains at the end without inserting 0.00, then verify the expected behavior across the listed browsers and versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100