Skip to content
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: cannot shift + num key #6257

Closed
enzolry opened this issue Mar 29, 2024 · 4 comments · Fixed by #6258
Closed

InputNumber: cannot shift + num key #6257

enzolry opened this issue Mar 29, 2024 · 4 comments · Fixed by #6258
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@enzolry
Copy link

enzolry commented Mar 29, 2024

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

@enzolry enzolry added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 29, 2024
@enzolry enzolry changed the title InputNumber: cannot shift + numeric keys InputNumber: cannot shift + num key Mar 29, 2024
@melloware
Copy link
Member

I think this is the same issue as #6237

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 29, 2024
melloware added a commit to melloware/primereact that referenced this issue Mar 29, 2024
@melloware melloware self-assigned this Mar 29, 2024
@melloware melloware added this to the 10.6.1 milestone Mar 29, 2024
@melloware
Copy link
Member

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
Copy link
Author

enzolry commented Mar 29, 2024

image

@melloware
Copy link
Member

Thanks! I think my PR will fix it.

gucal added a commit that referenced this issue Apr 9, 2024
Fix #6257: InputNumber SHIFT key fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants