Repository navigation
Fix ActionMenu anchor keydown listener cleanup - #8709
tay1orjones merged 6 commits into
Conversation
🦋 Changeset detectedLatest commit: 5f5a3f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
🟡 Changes recommended
An active release-note nit flags the missing ActionMenu: prefix and wording that describes internal cleanup rather than the consumer-facing memory leak fix.
1 open issue
What changed in this PR
Fixes ActionMenu’s anchor keyboard-listener leak, addressing the listener-cleanup item in #8676 without changing the public API.
Changes:
- Removes the anchor’s
keydownlistener during effect cleanup. - Adds regression coverage for cleanup across three menu open/close cycles.
- Adds a patch changeset for
@primer/react.
| File | Description |
|---|---|
packages/react/src/hooks/useMenuKeyboardNavigation.ts |
Corrects keyboard-listener cleanup. |
packages/react/src/ActionMenu/ActionMenu.test.tsx |
Tests listener removal across repeated open/close cycles. |
.changeset/icy-suits-lead.md |
Records the fix for a patch release. |
Review effort: Max
|
Hey @TheoGoulart333! 👋 Could you take a look at the copilot suggestion and also look into the react-18 CI failure? |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Integration test results from github/github-ui PR:
All checks passed! |

Contributes to #8676
Summary
keydownlistener during cleanup inuseMoveFocusToMenuItem.Changelog
Changed
New
Removed
Rollout strategy
Testing & Reviewing
packages/react/src/ActionMenu/ActionMenu.test.tsx.ActionMenu.test.tsxsuite passed in the fork's GitHub Actions workflow: 61 tests passed.