Skip to content

Revert "Replace ActionBar overflow calculations with CSS wrapping approach"#7807

Merged
TylerJDev merged 1 commit intomainfrom
revert-7655-actionbar-css
May 6, 2026
Merged

Revert "Replace ActionBar overflow calculations with CSS wrapping approach"#7807
TylerJDev merged 1 commit intomainfrom
revert-7655-actionbar-css

Conversation

@TylerJDev
Copy link
Copy Markdown
Member

Reverts #7655

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

⚠️ No Changeset found

Latest commit: fe7dcc2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

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

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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 May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

⚠️ Action required

👋 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. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@TylerJDev TylerJDev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label May 6, 2026
@primer-integration
Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/20034

@primer-integration
Copy link
Copy Markdown

Integration test results from github/github-ui:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

@primer-integration
Copy link
Copy Markdown

Integration test results from github/github-ui:

Running  CI   Running
Passed  VRT   Passed
Passed  Projects   Passed

@TylerJDev TylerJDev marked this pull request as ready for review May 6, 2026 14:33
Copilot AI review requested due to automatic review settings May 6, 2026 14:33
@TylerJDev TylerJDev requested a review from a team as a code owner May 6, 2026 14:33
@TylerJDev TylerJDev requested a review from liuliu-dev May 6, 2026 14:33
@TylerJDev TylerJDev merged commit a431e94 into main May 6, 2026
70 of 71 checks passed
@TylerJDev TylerJDev deleted the revert-7655-actionbar-css branch May 6, 2026 14:33
Copy link
Copy Markdown
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 reverts #7655, moving ActionBar overflow handling away from the recent CSS-wrapping approach and back to a JS-driven measurement/overflow-menu model.

Changes:

  • Reintroduces overflow calculation logic in ActionBar using measured child widths and a resize observer to populate the overflow menu.
  • Simplifies ActionBar CSS by removing the prior overflow-detection / wrapping styles.
  • Updates unit/e2e tests and adds a Storybook example (text-labeled buttons); removes the changeset from the reverted PR.
Show a summary per file
File Description
packages/react/src/ActionBar/ActionBar.tsx Restores JS-based overflow logic, introduces width measurement + registry-driven overflow menu rendering.
packages/react/src/ActionBar/ActionBar.test.tsx Updates the zero-width test assertion to query by accessible name instead of test id.
packages/react/src/ActionBar/ActionBar.module.css Removes CSS overflow detection/wrapping styles and tweaks alignment/nowrap behavior.
packages/react/src/ActionBar/ActionBar.examples.stories.tsx Adds a TextLabels example using standard Button children.
e2e/components/drafts/ActionBar.test.ts Updates overflow interaction assertions to count buttons without visible: true filtering.
.changeset/many-suns-promise.md Removes the changeset associated with the reverted change.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 6

Comment on lines +257 to +285
// First, we check if we can fit all the items with their icons
if (registryEntries.length >= numberOfItemsPossible) {
/* Below is an accessibility requirement. Never show only one item in the overflow menu.
* If there is only one item left to display in the overflow menu according to the calculation,
* we need to pull another item from the list into the overflow menu.
*/
const numberOfItemsInMenu = registryEntries.length - numberOfItemsPossibleWithMoreMenu
const numberOfListItems =
numberOfItemsInMenu === 1 ? numberOfItemsPossibleWithMoreMenu - 1 : numberOfItemsPossibleWithMoreMenu
for (const [index, [id, child]] of registryEntries.entries()) {
if (index < numberOfListItems) {
continue
//if the last item is a divider
} else if (child.type === 'divider') {
if (index === numberOfListItems - 1 || index === numberOfListItems) {
continue
} else {
menuItems.add(id)
}
} else {
menuItems.add(id)
}
}

const {containerRef} = useFocusZone(
{
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
focusOutBehavior: 'wrap',
focusableElementFilter: element => element.matches(FOCUSABLE_ITEM_SELECTOR),
return menuItems
} else if (numberOfItemsPossible > registryEntries.length && hasActiveMenu) {
/* If the items fit in the list and there are items in the overflow menu, we need to move them back to the list */
return new Set()
}
{menuItemIds.size > 0 && (
<ActionMenu>
<ActionMenu.Anchor>
<IconButton variant="invisible" aria-label={`More ${ariaLabel} items`} icon={KebabHorizontalIcon} />
Comment on lines +315 to +319
const moreMenuRef = useRef<HTMLLIElement>(null)

useResizeObserver((resizeObserverEntries: ResizeObserverEntry[]) => {
const navWidth = resizeObserverEntries[0].contentRect.width
const moreMenuWidth = moreMenuRef.current?.getBoundingClientRect().width ?? 0
Comment on lines +465 to 466
useIsomorphicLayoutEffect(() => setWidth(ref.current?.getBoundingClientRect().width ?? -1), [ref])

Comment on lines +41 to +44
* Registry of descendants to render in the list or menu. To preserve insertion order across updates, children are
* set to `null` when unregistered rather than fully dropped from the map.
*/
type ChildRegistry = ReadonlyMap<string, ChildProps | null>
{menuItemIds.size > 0 && (
<ActionMenu>
<ActionMenu.Anchor>
<IconButton variant="invisible" aria-label={`More ${ariaLabel} items`} icon={KebabHorizontalIcon} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR 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.

3 participants