Skip to content

Fix ActionMenu anchor keydown listener cleanup - #8709

Merged
tay1orjones merged 6 commits into
primer:mainfrom
TheoGoulart333:codex/fix-action-menu-keydown-cleanup
Nov 19, 2026
Merged

tay1orjones merged 6 commits into
primer:mainfrom
TheoGoulart333:codex/fix-action-menu-keydown-cleanup

Conversation

@TheoGoulart333

@TheoGoulart333 TheoGoulart333 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Contributes to #8676

Summary

  • Remove the anchor keydown listener during cleanup in useMoveFocusToMenuItem.
  • Add a regression test that opens and closes the menu repeatedly and checks listener cleanup.

Changelog

Changed

  • Fixed a leaked keyboard event listener in ActionMenu. No public API changes.

New

  • Added regression coverage for repeated menu open and close cycles.

Removed

  • None.

Rollout strategy

  • None — internal bug fix with no public API changes.

Testing & Reviewing

  • Regression test added to packages/react/src/ActionMenu/ActionMenu.test.tsx.
  • The targeted ActionMenu.test.tsx suite passed in the fork's GitHub Actions workflow: 61 tests passed.
  • Upstream checks remain pending maintainer approval.

@TheoGoulart333
TheoGoulart333 requested a review from a team as a code owner November 7, 2026 19:32
@changeset-bot

changeset-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5f5a3f8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 keydown listener 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

Comment thread .changeset/icy-suits-lead.md Resolved
@tay1orjones

Copy link
Copy Markdown
Contributor

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>
@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  Changes   Passed
Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

@tay1orjones
tay1orjones added this pull request to the merge queue Nov 19, 2026
Merged via the queue into primer:main with commit 1588875 Nov 19, 2026
46 of 52 checks passed
@primer primer Bot mentioned this pull request Nov 19, 2026

This branch was successfully deployed

1 active deployment
github-pages — 5f5a3f8a Deployed Nov 19, 2026 by tay1orjones via deploy-preview #30766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants