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

Dropdown: items focused when pressing letters in contexts where they shouldn't #5855

Closed
inad9300 opened this issue Jan 30, 2024 · 5 comments · Fixed by #5857 or #7560
Closed

Dropdown: items focused when pressing letters in contexts where they shouldn't #5855

inad9300 opened this issue Jan 30, 2024 · 5 comments · Fixed by #5857 or #7560
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@inad9300
Copy link
Contributor

Describe the bug

When a dropdown element is focused, if you use the "Ctrl+F" browser shortcut, the first menu item starting with "F" will be selected.

Reproducer

https://codesandbox.io/s/primereact-demo-forked-y5t86v?file=/src/App.jsx

PrimeReact version

10.3.3

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Focus on the dropdown element.
  2. Press "Ctrl+F".
  3. See how the selection changes to "Frankfurt".

Expected behavior

Shortcuts (not just "Ctrl+F", but all of them) should not have an effect on menu item selection. Native HTML <select> elements have the right behavior.

@inad9300 inad9300 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 30, 2024
@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 Jan 30, 2024
@melloware melloware self-assigned this Jan 30, 2024
@melloware melloware added this to the 10.4.0 milestone Jan 30, 2024
melloware added a commit to melloware/primereact that referenced this issue Jan 30, 2024
@inad9300
Copy link
Contributor Author

inad9300 commented Jan 3, 2025

@melloware I'm experiencing this issue again with keyboard shortcuts such as "Alt+D" (moves the focus to the browser's address bar).

@melloware melloware reopened this Jan 3, 2025
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 3, 2025
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 3, 2025
@melloware
Copy link
Member

@inad9300 you want ALT+D blocked if they are in the dropdown? but that is a browser navigation shortcut why would you want it stopped? If you are looking for character "D" for "David" in the dropdown why are you pressing ALT+D which is the browser shortcut to take you to the Navigation bar?

@inad9300
Copy link
Contributor Author

inad9300 commented Jan 3, 2025

I'm trying to use a browser shortcut while a dropdown happens to have the focus, and don't want that to start changing things in the UI. Just like in the original ticket, neither "Ctrl+F" nor "Alt+D", etc. should cause the dropdown to open and preselect a new item. Only pressing "F" or "D" without any other key while the dropdown is focused should trigger its opening.

@melloware
Copy link
Member

OH so if you had an item with a D in it its selecting it. That is bad.

@melloware
Copy link
Member

Ahhh I looked through Git History and when PrimeTek refactored for Accesibility they removed the ALT_KEY check. I have restored it for 10.9.2

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
2 participants