primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.97k stars 1.06k forks source link

InputNumber: cannot shift + num key #6257

Closed enzolry closed 7 months ago

enzolry commented 8 months ago

Describe the bug

I'm using a 75% layout keyboard, so I don't have a numpad.

I upgraded to PrimeReact 10.5.3, and I realized much later that I could no longer use Shift+num key (above alphabetical keys) combination inside the input anymore.

Also, when I focus the input and click on a suggestion from browser, I get the following error

TypeError: Cannot read properties of undefined (reading 'startsWith') at Object.onInputKeyDown

in inputnumber component at line 665

if ((event.code.startsWith('Digit') || event.code.startsWith('Numpad')) && Number(_char) >= 0 && Number(_char) <= 9 || _isMinusSign || _isDecimalSign) {
// ...
}

Reproducer

https://stackblitz.com/edit/vitejs-vite-olqmfh

PrimeReact version

10.5.3

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. click on the input
  2. make shift + num key combination
  3. onChange event should not be triggered

Expected behavior

No response

melloware commented 8 months ago

I think this is the same issue as https://github.com/primefaces/primereact/issues/6237

melloware commented 8 months ago

can you also go here and press SHIFT+NUM like you would so I can see what it does: https://w3c.github.io/uievents/tools/key-event-viewer.html

enzolry commented 8 months ago

image

melloware commented 8 months ago

Thanks! I think my PR will fix it.