Skip to content

Conversation

TylerJDev
Copy link
Member

@TylerJDev TylerJDev commented Oct 10, 2025

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

Adds sub component ActionBar.Group.

  • Introduces submenus inside of the overflow menu when ActionBar.Group is used
  • Adds items to overflow menu by group instead of individual item

Changelog

New

  • Adds ActionBar.Group sub component

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

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: 8eed237

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

This PR includes changesets to release 2 packages
Name Type
@primer/react Minor
@primer/styled-react Major

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 the staff Author is a staff member label Oct 10, 2025
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 10, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-6979 October 10, 2025 15:38 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6979 October 13, 2025 14:38 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6979 October 13, 2025 14:46 Inactive
@TylerJDev TylerJDev requested a review from pksjce October 13, 2025 22:06
@TylerJDev TylerJDev marked this pull request as ready for review October 13, 2025 22:06
@TylerJDev TylerJDev requested a review from a team as a code owner October 13, 2025 22:06
@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 22:06
Copy link
Contributor

@Copilot 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 introduces group functionality to the ActionBar component by adding a new ActionBar.Group sub-component. This enhancement allows related actions to be logically grouped together and appear as submenus in the overflow menu when space is limited.

Key changes:

  • Adds ActionBar.Group component for organizing related actions
  • Introduces submenu functionality within the overflow menu for grouped items
  • Updates overflow behavior to handle groups as units rather than individual items

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/react/src/ActionBar/index.ts Export new ActionBarGroup component and add it to ActionBar compound component
packages/react/src/ActionBar/ActionBar.tsx Implement ActionBarGroup component and update overflow logic to support grouped items
packages/react/src/ActionBar/ActionBar.test.tsx Add tests for group ordering and conditional rendering with groups
packages/react/src/ActionBar/ActionBar.module.css Add CSS styling for the Group component
packages/react/src/ActionBar/ActionBar.examples.stories.tsx Add story example demonstrating ActionBar.Group usage
packages/react/src/ActionBar/ActionBar.docs.json Document ActionBar.Group component props
.changeset/busy-islands-fail.md Add changeset entry for minor release

disabled: !!disabled,
onClick: onClick as MouseEventHandler,
width: widthRef.current,
groupId: groupId ?? undefined, // todo: remove conditional
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

Remove the unnecessary conditional and TODO comment. The groupId ?? undefined expression is redundant since groupId is already string | null and can be passed directly.

Suggested change
groupId: groupId ?? undefined, // todo: remove conditional
groupId: groupId,

Copilot uses AI. Check for mistakes.

Comment on lines +273 to +278
// TODO: refine this so that we don't have to loop through the registry multiple times
const groupedItems = Array.from(childRegistry).filter(([, childProps]) => {
if (childProps?.type !== 'action') return false
if (childProps.groupId !== id) return false
return true
})

This comment was marked as spam.

Comment on lines +353 to +355
return () => {
unregisterChild(id)
}
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The cleanup function can be simplified to return () => unregisterChild(id) since it's just a single function call.

Suggested change
return () => {
unregisterChild(id)
}
return () => unregisterChild(id)

Copilot uses AI. Check for mistakes.

@pksjce pksjce self-assigned this Oct 14, 2025
@dusave
Copy link
Contributor

dusave commented Oct 15, 2025

Introduces submenus inside of the overflow menu when ActionBar.Group is used

@TylerJDev @pksjce I just want to make sure this is captured correctly. The use of ActionBar.Group shouldn't be related to submenus in the overflow.

For Groups, I was pitching that it made sense for groups of items to move into the menu in certain cases (like when you have bold, italics, and underline) because leaving only one or two of the options didn't really make sense.

For sub-menus, this was meant for a continuation of the action menu components in the action bar itself. For instance, the Heading button would have a dropdown with headings 1-6. When that overflows into the menu, that item would then need to have a sub-menu.

Hope that clarifies things 😄

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.

4 participants