Skip to content

useMnemonics hook should ignore keydown events from textarea elements #2316

Description

@willglas

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreact

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions