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 input numbers in AZERTY layout #5508

Closed
justinrlle opened this issue Apr 2, 2024 · 5 comments · Fixed by #5560 or DallinAllred/ezanalytics#11 · May be fixed by jennytoc/mfe-proj#2
Closed

InputNumber: Cannot input numbers in AZERTY layout #5508

justinrlle opened this issue Apr 2, 2024 · 5 comments · Fixed by #5560 or DallinAllred/ezanalytics#11 · May be fixed by jennytoc/mfe-proj#2
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@justinrlle
Copy link

Describe the bug

When typing in an InputNumber in AZERTY layout, no number can be set, and undefined is in fact set in the component.

I'm on MacOS, but not sure it's the issue here, I think the browser abstract away this detail.

Reproducer

https://primevue.org/inputnumber/

PrimeVue version

3.50.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

ALL (checked on Chrome and Safari)

Steps to reproduce the behavior

  1. Set your keyboard layout to AZERTY
  2. Go to https://primevue.org/inputnumber/
  3. Try to type in a number
  4. If the input is empty, no number is shown. If there is a number, the value is replaced by undefined.

In the video you can see the keys I'm pressing in both InputNumber and InputText, they're the same and should produce 2020

PrimeVue.-.InputNumber.AZERTY.bug.mov

Expected behavior

A number is inputed.

From my quick diving in the code, the issue is with this lines in the onInputKeyDown event:

            if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
                this.isSpecialChar = true;

                return;
            }

So if a Shift key is pressed, the event handler does an early return. Unfortunately, on an AZERTY layout, one must do a combination of Shift+number-key to input a number.

@justinrlle justinrlle added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 2, 2024
@justinrlle
Copy link
Author

From my tests, it looks like the bug got introduced in 3.50.0, that is the bug does not exists in 3.49.1.

Precisely, I have the feeling that the bug appeared with this commit: ec04c03
At least that's the one which changes the most, and removes the keypress event handler which didn't do an early return.

@kevinbal1
Copy link

I confirm this issue, having it as well, only on AZERTY layouts.

@melloware
Copy link
Member

This was fixed in PrimeReact: primefaces/primereact#6258

@arlai-mk
Copy link

This was fixed in PrimeReact: primefaces/primereact#6258

Great, so it seems it should be easy to fix for PrimeVue as well?
Just remove the event.shiftKey || in https://github.com/primefaces/primevue/blob/master/components/lib/inputnumber/InputNumber.vue#L379

If that's the case, are you able to merge the fix for 3.52.0 milestone https://github.com/primefaces/primevue/milestone/178, as I had to rollback to 3.49.1 to get it to work on my app.

Thank you.

@melloware
Copy link
Member

@arlai-mk yes let me submit a PR

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 19, 2024
@tugcekucukoglu tugcekucukoglu added this to the 3.52.0 milestone Apr 19, 2024
tugcekucukoglu added a commit that referenced this issue Apr 19, 2024
Fix #5508: InputNumber allow AZERTY keyboards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
5 participants