Skip to content

Breadcrumbs: Show only current page on narrow viewports with overflow menu#7754

Open
liuliu-dev wants to merge 5 commits intomainfrom
liuliu/breadcrumbs-narrow-viewport
Open

Breadcrumbs: Show only current page on narrow viewports with overflow menu#7754
liuliu-dev wants to merge 5 commits intomainfrom
liuliu/breadcrumbs-narrow-viewport

Conversation

@liuliu-dev
Copy link
Copy Markdown
Contributor

@liuliu-dev liuliu-dev commented Apr 14, 2026

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

Changelog

On narrow container width (<544px), when overflow="menu" is set, the Breadcrumbs component now collapses all items except the current page (last breadcrumb) into the overflow menu.

Before After
Screenshot 2026-04-14 at 10 20 34 AM Screenshot 2026-04-14 at 10 20 20 AM

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
Copy Markdown

changeset-bot bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: 29ad55e

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

@liuliu-dev liuliu-dev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Uh oh! @liuliu-dev, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 13
  • Images should have meaningful alternative text (alt text) at line 13
  • Images should have meaningful alternative text (alt text) at line 13
  • Images should have meaningful alternative text (alt text) at line 13

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@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 Apr 14, 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.

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

@github-actions github-actions bot temporarily deployed to storybook-preview-7754 April 14, 2026 21:23 Inactive
@liuliu-dev liuliu-dev added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Apr 14, 2026
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Apr 14, 2026
@primer-integration
Copy link
Copy Markdown

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

@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!

@liuliu-dev liuliu-dev marked this pull request as ready for review April 14, 2026 22:22
@liuliu-dev liuliu-dev requested a review from a team as a code owner April 14, 2026 22:22
Copilot AI review requested due to automatic review settings April 14, 2026 22:22
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

Updates the Breadcrumbs overflow behavior to better support small-screen layouts by collapsing to fewer visible items when using menu overflow, and adds VRT coverage for the new/expected responsive rendering.

Changes:

  • Adjusted overflow calculation to reduce visible breadcrumb items at the <544px breakpoint for overflow="menu".
  • Added Playwright VRT cases for overflow-menu stories at narrow and wide viewport sizes.
  • Added new/updated Playwright snapshot baselines and a patch changeset entry.
Show a summary per file
File Description
packages/react/src/Breadcrumbs/Breadcrumbs.tsx Updates overflow/min-visible-items logic with a narrow breakpoint condition.
e2e/components/Breadcrumbs.test.ts Adds VRT coverage for overflow menu behavior at narrow/wide viewports.
.playwright/snapshots/components/Breadcrumbs.test.ts-snapshots/Breadcrumbs-OverflowMenuWithRoot-narrow-linux.png Adds new VRT baseline for overflow menu with root at narrow viewport.
.playwright/snapshots/components/Breadcrumbs.test.ts-snapshots/Breadcrumbs-OverflowMenu-wide-linux.png Adds new VRT baseline for overflow menu at wide viewport.
.playwright/snapshots/components/Breadcrumbs.test.ts-snapshots/Breadcrumbs-OverflowMenu-narrow-linux.png Adds new VRT baseline for overflow menu at narrow viewport.
.changeset/fast-pugs-camp.md Patch changeset documenting the new narrow-viewport overflow-menu behavior.

Copilot's findings

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

Comment on lines +192 to +194
const NARROW_BREAKPOINT = 544
const isNarrow = availableWidth < NARROW_BREAKPOINT
const MIN_VISIBLE_ITEMS = isNarrow && eHideRoot ? 1 : !eHideRoot ? 3 : 4
Comment on lines +192 to +193
const NARROW_BREAKPOINT = 544
const isNarrow = availableWidth < NARROW_BREAKPOINT
Copy link
Copy Markdown
Member

@francinelucca francinelucca left a comment

Choose a reason for hiding this comment

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

approving with non-blocking comments!

const MIN_VISIBLE_ITEMS = !eHideRoot ? 3 : 4
const NARROW_BREAKPOINT = 544
const isNarrow = availableWidth < NARROW_BREAKPOINT
const MIN_VISIBLE_ITEMS = isNarrow && eHideRoot ? 1 : !eHideRoot ? 3 : 4
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I feel like these double ternaries are hard to read. I'd split this into multiple lines or a function

'@primer/react': patch
---

Breadcrumbs: On narrow viewports, only show the current page breadcrumb and the overflow menu when `overflow="menu"` is set.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if this should be the default 🤔

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants