primereact
primereact copied to clipboard
InputNumber: onChange and onValueChange events are not triggered when using keyboard shortcut for "cut" action
Describe the bug
The onChange and onValueChange events associated with an input field fail to trigger in two scenarios:
- When attempting to cut all numbers using a keyboard shortcut (e.g., Ctrl + X) after selecting all text in the input field the event is not triggered at all, but the value in input is changed.
- When selecting a portion of the text using shift+arrow keys and then attempting to perform the cut action, it does not execute at all.
Reproducer
https://stackblitz.com/edit/vitejs-vite-i8hwvq?file=src%2FApp.tsx
PrimeReact version
10.3.3
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
- Put some value in the InputNumber
- Select text
- Perform cut action using Ctrl + X
Expected behavior
Events should be triggered correctly
I think this will be fixed if InputNumber switches from onKeyPress to onKeyUp. There is an open PrimeVue ticket about it I have been monitoring: https://github.com/primefaces/primevue/issues/5008