primevue
primevue copied to clipboard
InputNumber: Bug deprecated KeyCode Usage
Describe the bug
Bug Summary
The current implementation of the onInputKeyPress method in the InputNumber component of PrimeVue relies on the deprecated keyCode property, which is set to be removed in future browser versions. This poses a potential risk of unsupported behavior as modern libraries and tools may cease to support this deprecated property.
Issue Details
The usage of keyCode is deprecated and marked for removal, causing compatibility issues with modern libraries and testing tools. For instance, the testing library (testing-library/user-event) no longer supports keyCode, as highlighted in this related issue: testing-library/user-event#842. When attempting to test the InputNumber component using this library, the keyCode remains 0, and no event is emitted.
Reproducer
https://codesandbox.io/p/devbox/wizardly-framework-5vw3dy?file=%2Fsrc%2FApp.vue%3A15%2C10
PrimeVue version
3.45.0
Vue version
3.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
I noticed this in PrimeReact as well
Thanks a lot for your report! I set a milestone for it. We'll update it before the milestone is released.