react
react copied to clipboard
`useMnemonics` hook should ignore keydown events from `textarea` elements
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
- Render a
textareaelement inside of aActionMenu.Overlay - Add some buttons with text
- Pick a character that one of your button starts with and type it into the
textarea - The button will get focused
Version
35.7.0
Browser
Chrome, Safari, Firefox, Edge, iOS Safari