Skip to content

fix(Breadcrumbs): let the nav shrink in a flex row so menu modes collapse - #8750

Draft
mattcosta7 wants to merge 2 commits into
mainfrom
mattcosta7-breadcrumbs-resize-perf
Draft

mattcosta7 wants to merge 2 commits into
mainfrom
mattcosta7-breadcrumbs-resize-perf

Conversation

@mattcosta7

Copy link
Copy Markdown
Contributor

Closes #

In menu and menu-with-root modes, Breadcrumbs collapsed late, and at different widths depending on crumb length, when placed in a flex row beside other content, as in the github/github-ui global header (ContextRegion inside TopNav.Center).

The <nav> is a flex item with the default min-width: auto, so it can't shrink below its crumbs. Its siblings absorb the squeeze first, the crumbs keep measuring as fitting, and nothing collapses until those siblings reach their minimum widths. Longer repo names reach that point at a wider viewport. Narrowing and widening also disagreed, by about 150px for long names.

This sets min-width: 0 on the nav in the menu modes, so the crumbs are fitted to the width the parent actually offers.

Measured in a Storybook mock of the header layout (not github-ui itself). Each cell is the header width where the collapse changes, narrowing / widening:

Repo name Before After
react 428 / 430 unchanged
github-ui 462 / 464 unchanged
primer-design-system-components 496 / 650 676 / 678
a-very-long-repository-name-for-testing 532 / 690 716 / 718

This is not a regression from #8683 or #8748. The implementation before #8683 never collapsed in this layout, and its crumbs spilled up to 249px outside the nav. A per-frame resize harness showed no change in collapse timing or frame times across before #8683, current main, and this branch.

Changelog

New

  • Browser test: Breadcrumbs collapse when sharing a flex row with a shrinkable sibling.

Changed

  • Breadcrumbs (overflow="menu" / "menu-with-root"): the nav can shrink below its content as a flex item, so crumbs collapse as soon as they stop fitting.

Removed

  • None

Rollout strategy

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Testing & Reviewing

  • npx vitest run --project '@primer/react' packages/react/src/Breadcrumbs: passed (3 files, 53 tests). The new test fails without the CSS change (expected [ 'owner', 'repository' ] to deeply equal [ 'repository' ]).
  • npx stylelint -q --rd packages/react/src/Breadcrumbs/Breadcrumbs.module.css: passed.
  • npx eslint packages/react/src/Breadcrumbs/__tests__/BreadcrumbsOverflow.test.tsx: passed.
  • npx prettier --check on changed files: passed.
  • Not run: full npm test, npm run type-check, VRT, and the github-ui integration workflow.

Risk: any consumer that relied on a menu-mode nav refusing to shrink in a flex row will now see crumbs collapse earlier. A github-ui integration run would confirm the header behaves as in the mock.

…apse

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e82a581

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

@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 Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ 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.

This branch was successfully deployed

2 active deployments
storybook-preview-8750 — e82a5812 Deployed Nov 14, 2026 by github-actions[bot]
github-pages — e82a5812 Deployed Nov 14, 2026 by mattcosta7 via deploy-preview #34309
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant