Skip to content

Conversation

@TylerJDev
Copy link
Member

Closes https://github.com/github/primer/issues/6117

Adds new prop to ActionBar.Menu, allowing developers to specify where focus should return when the menu is closed via the new returnFocusRef prop.

Changelog

New

  • Adds returnFocusRef prop to ActionBar.Menu

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@changeset-bot
Copy link

changeset-bot bot commented Dec 30, 2025

🦋 Changeset detected

Latest commit: 43e5000

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Dec 30, 2025
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@TylerJDev TylerJDev marked this pull request as ready for review December 30, 2025 17:48
@TylerJDev TylerJDev requested a review from a team as a code owner December 30, 2025 17:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds focus management flexibility to the ActionBar component by introducing a new returnFocusRef prop to ActionBar.Menu. This allows developers to specify a custom focus target when the menu closes, instead of defaulting to the anchor button.

Key Changes

  • Added returnFocusRef prop to ActionBar.Menu component that accepts a ref to an HTMLElement
  • Integrated the prop throughout the component hierarchy, including overflow menu rendering
  • Added comprehensive test coverage for the new functionality including escape key, item selection, and default behavior scenarios

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/ActionBar/ActionBar.tsx Added returnFocusRef prop to type definitions, threaded it through the component hierarchy, and passed it to ActionMenu.Overlay in both direct usage and overflow menu contexts
packages/react/src/ActionBar/ActionBar.test.tsx Added four comprehensive tests covering prop acceptance, focus return on escape, focus return on item selection, and default behavior when prop is not provided
packages/react/src/ActionBar/ActionBar.docs.json Added documentation for the new returnFocusRef prop with clear description of its purpose
.changeset/curvy-walls-exist.md Added changeset entry for the new feature (though version should be minor not patch)

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

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants