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

useMnemonics hook should ignore keydown events from textarea elements #2316

Closed
willglas opened this issue Sep 7, 2022 · 0 comments · Fixed by #2317
Closed

useMnemonics hook should ignore keydown events from textarea elements #2316

willglas opened this issue Sep 7, 2022 · 0 comments · Fixed by #2317
Assignees
Labels
bug Something isn't working react

Comments

@willglas
Copy link
Contributor

willglas commented Sep 7, 2022

Description

When a textarea element is rendered inside of an ActionMenu.Overlay with some named buttons, random buttons will get focused as the user is typing. This is because the useMnemonics hook ignores keydown events from input elements but not textarea elements here:

https://github.com/primer/react/blob/main/src/hooks/useMnemonics.ts#L40

Steps to reproduce

  1. Render a textarea element inside of a ActionMenu.Overlay
  2. Add some buttons with text
  3. Pick a character that one of your button starts with and type it into the textarea
  4. The button will get focused

Version

35.7.0

Browser

Chrome, Safari, Firefox, Edge, iOS Safari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working react
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants