admin-ui: let the Page header's leading group and Breadcrumbs nav shrink so long crumbs truncate - #81301
Conversation
The Page header renders its leading group (sidebar toggle, visual, title, breadcrumbs, badges) as a flex item with the default min-width: auto, and the Breadcrumbs nav is another flex item inside it. A nowrap crumb's min-content therefore propagates up the chain and widens the whole page into horizontal scrolling before the truncation styles already present on .current (and the shrinkable li:last-child) can engage. Give both links in the chain min-width: 0 so the existing truncation works as intended. Fixes WordPress#81297.
|
Could we add screenshots (or even better, screencasts of the responsive behaviour) for both the issue and this PR? It's hard to understand exactly what's the issue and the solution proposed by reading the PR description |
|
Good call — I've added before/after screenshots to the PR description and mirrored them on #81297 (taken on the Admin UI/Page → WithBreadcrumbs story with the last crumb swapped for a long unbroken string, same viewport width in both shots). One detail worth calling out: the standalone Breadcrumbs stories truncate correctly even without this change — the defect only appears once the nav sits inside the Page header's flex chain, which is exactly what the two min-width: 0 rules unblock. Screencast of the responsive behaviour below: first clip is trunk (the crumb refuses to shrink and the page scrolls horizontally as the viewport narrows), second is this branch (the existing ellipsis engages and the page keeps its width). Before2026-08-07.11.50.03.movAfter2026-08-07.11.49.08.mov |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Closes #81297
Lets the
admin-uiPageheader's leading group and theBreadcrumbsnavshrink (min-width: 0), so a long current crumb truncates with its existing ellipsis instead of widening the whole page into horizontal scrolling.Why?
The
Pageheader renders its leading group (sidebar toggle, visual, title, breadcrumbs, badges) as a flex item with the flexbox defaultmin-width: auto, and theBreadcrumbsnavis another flex item inside it. A nowrap crumb's min-content therefore propagates up that chain and forces the page wider than its container before the truncation styles thatBreadcrumbsalready ships (.current's ellipsis, the shrinkableli:last-child) can engage.Consumers currently have to patch this from outside with structural selectors (e.g.
:has(> nav[aria-label]) { min-inline-size: 0 }), which breaks silently as soon as any wrapper — adisplay: contentsone, for instance — lands between the header and thenav. See #81297 for the full analysis; the slot is also set to be reworked under #77039 / #77628, and this pins the propagation fix until those land.How?
Two links in the chain get
min-width: 0:page/header.tsx— the leadingStackgains aheader-leadingclass;page/style.module.csssetsmin-width: 0on it.breadcrumbs/index.tsx— thenavgains arootclass;breadcrumbs/style.module.csssetsmin-width: 0on it.No behavior change for content that fits:
min-width: 0only removes the automatic minimum, it does not make anything smaller on its own.Testing Instructions
admin-uiPagewith breadcrumbs whose last item is a long unbroken string, e.g.:BreadcrumbsStorybook story with a long last label works as well.)Testing Instructions for Keyboard
Tab through the breadcrumb links before and after narrowing the viewport: link order, focusability, and visible focus outlines are unchanged — this PR only allows the existing flex chain to shrink, it adds no interactive changes.
Screenshots
Taken on the
Admin UI/Page→WithBreadcrumbsstory with the last crumb replaced by a long unbroken string (VID_20260731_aaa….mp4), viewport narrower than the crumb's natural width.Screencasts
Before
2026-08-07.11.50.03.mov
After
2026-08-07.11.49.08.mov