Repository navigation
fix(TopNav): let the heading shrink so a long heading truncates inside its column - #9551
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TopNavHeading | 73.9 kB (+209 B) · 11.1 kB CSS (+130 B) | — | ✓ · ✓ · ✓ |
| TopNavItem | 13.7 kB (0) · 4.0 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TopNavMegaMenu | 68.5 kB (0) · 11.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
4 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TopNavMegaMenuFeaturedCard | 7.3 kB (0) · 3.6 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TopNavMegaMenuItem | 13.7 kB (0) · 4.2 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TopNavMenu | 73.4 kB (0) · 11.2 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TopNav | 71.1 kB (−1 B) · 10.8 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 6.99 MB packed (+1.1 kB); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 40 rows; run pnpm api:report.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Outcome: the fix works (a long heading now truncates with an ellipsis inside its column, and bars that fit are unchanged), but it needs one change and an engineering owner decision before it can be approved.
Required change:
.changeset/topnav-heading-shrink.mdline 5 says a long heading pushed "the start, center and end content out of the bar", but onmainthe center and end content stay in place and the heading runs under them, so please reword it, for example "…instead of running under the center or end content (#9530)."
Owner decision: when nav items crowd the default bar, the heading now gives up all of its width: in the TopNav / Full example story at a 700 px viewport, Enterprise Dashboard disappears, and at 600 px the logo and the first item overlap. No current TopNav clause says which part should yield there, so an engineering owner needs to accept this, by commenting /approve-spec <full head SHA> on this pull request, or ask for a different yield order; the author may do so if they are an engineering owner. CI has not run on this head yet: it runs once a maintainer adds the ci:run label.
[Automated review]
… the logo The heading column shrinks down to its own minimum instead of to zero. TopNavHeading lays out as a grid, so its minimum is the logo and the controls beside the text: the text column truncates first and the logo never shrinks; once only the logo is left, the start region overflows as before. TopNavHeading FR1 states it. A real-Chromium spec checks the 700 px and 600 px FullExample and a long heading beside the end content. Co-authored-by: David Billiot <[email protected]>
… class and checks that the page does not scroll sideways
|
/approve-spec 83c22a2 |
There was a problem hiding this comment.
Outcome: changes requested. The fix works (a long heading now truncates inside its column, a crowded bar keeps the logo, and bars that fit render as before), but two things need a fix:
TopNavHeading's new grid root (TopNavHeading.tsxlines 65-67) leaves the auto margin onheaderEndContentnothing to push, so in any root wider than its parts (for example a standalone heading in a 420 px container) the end content now sits right after the text instead of at the inline end that TopNavHeading FR1 requires; sizing the text column's trackminmax(0, 1fr)(auto minmax(0, 1fr)after a logo) restores it without changing how a crowded bar behaves.- The changeset's second sentence says a crowded
TopNavHeading"truncates its text first", but linked lines wrap (FR1), so in the independent-links configuration the heading wraps to three lines and the bar grows from 50 to 90 px; please reword it, for example "…narrows its text first (one-line text truncates and linked lines wrap) and keeps its logo."
Two small comment rewrites are suggested inline and are not blocking. CI has not run on this head yet; it runs once a maintainer adds the ci:run label.
[Automated review]
The text track is minmax(0, 1fr), after an auto logo track when a logo is present, so free space sits in the text and end content stays at the inline end. A crowded bar still narrows the text first and keeps the logo.
Co-authored-by: WeAreResilience <[email protected]>
There was a problem hiding this comment.
Outcome: waiting on an engineering owner's decision, plus one required change. A long one-line heading now ends in an ellipsis inside its column, and a crowded bar keeps the logo and the menu chevron.
Required change:
- With independent links, the new
minmax(min-content, 1fr)track (TopNavHeading.tsxlines 91-96) counts a one-line plain line at its full width, so a long plainheadingunder a linkedsuperheadingstill never truncates and, in #9530's own repro, still runs under the search field exactly as onmain; please make those plain lines truncate as in the other configurations, or narrow the changeset's "a long heading truncates" claim to match.
Decision needed:
- TopNavHeading FR1's new sentence ("the text column truncates first; the logo never shrinks") was approved at an earlier head, and that approval no longer covers this one; an engineering owner should confirm it together with how crowded linked lines behave here: with independent links they keep their longest word and the bar grows (50 to 85 px at 560 px), while beside a
menuthey are cut mid-word at the chevron's 32 px with no ellipsis (Miss: the earlier review asked only about the no-menu case).
An engineering owner records the decision by commenting /approve-spec followed by the full head SHA; the author may do so if they are an engineering owner. A small comment rewrite is suggested inline and is not blocking. CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
[Automated review]
| // The text track can shrink to zero. The logo and the chevron row keep | ||
| // their width. |
There was a problem hiding this comment.
Non-blocking (comment accuracy): with menu the track stops at the chevron, and with independent links at the longest linked word. Suggested: The logo keeps its width. The text track yields first, down to the chevron with a menu or the longest word of a linked line.
…s keeps its longest word and wraps Co-authored-by: WeAreResilience <[email protected]>
|
/approve-spec 5e17ac5 |
1 similar comment
|
/approve-spec 5e17ac5 |
There was a problem hiding this comment.
Outcome: changes requested. A TopNavHeading wider than the whole bar now ends in its ellipsis inside the bar instead of scrolling the page sideways, and the new FR1 wording carries an engineering owner's approval for this head. Both fixes below are needed because main's bar-wrapping change was merged in:
- Regression: a crowded bar now wraps its nav items and end content onto new rows, so 5 of the 6 tests in
TopNavCrowdedHeading.a11y.chromium.spec.tsfail (lines 73, 108 and 151); please assert what this change restores (a heading wider than the bar truncates and the page does not scroll sideways) and check that the heading's box overlaps no other region instead of comparing left and right edges. - Regression: the changeset (line 5) and the description's user impact say a long heading runs under the center or end content (#9530), which the merged base no longer does, and that one-line text truncates in a crowded bar, which a plain heading under a linked superheading still does not; please narrow it, for example to
TopNav's heading can now shrink, so a heading wider than the whole bar ends in an ellipsis instead of running off the bar and scrolling the page sideways (#9530). TopNavHeading keeps its logo whole.
CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
[Automated review]
…roll now that the bar wraps With the bar's row wrap on main, a crowded bar moves its nav items and end content to new rows, so comparing left and right edges no longer holds. The spec now checks that the heading's box overlaps no other control, that a heading wider than the whole bar truncates, and that the page does not scroll sideways. The changeset says what this restores on the current base. Co-authored-by: WeAreResilience <[email protected]>
|
/approve-spec c410440 |
There was a problem hiding this comment.
Changes requested: a TopNavHeading wider than the whole bar now ends in its ellipsis instead of scrolling the page sideways, and the rewritten Chromium spec passes on the wrapping bar, but the release note needs one fix.
- The changeset (
.changeset/topnav-heading-shrink.mdline 5) and the PR body's user impact claim more than the change does:mainnever clipped independently linked lines to nothing (the PR's own Independent Heading Links Chromium cases already pass there), and a plainheadingunder a linkedsuperheadingstill keeps its full width and scrolls the page sideways when it is wider than the bar.
Suggested changeset wording: TopNav's heading can now shrink, so a heading wider than the whole bar ends in an ellipsis instead of running off the bar and scrolling the page sideways (#9530). TopNavHeading keeps its logo whole, and independently linked lines wrap and keep their longest word; a plain line beside them still keeps its full width. Please also drop the body's "clip to nothing" sentence.
CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
[Automated review]
…nges Co-authored-by: WeAreResilience <[email protected]>
|
/approve-spec c30126f |
There was a problem hiding this comment.
Approved. A TopNav heading wider than the whole bar now ends in an ellipsis inside the bar instead of scrolling the page sideways, and TopNavHeading keeps its logo whole. The crowded-heading browser spec's truncation case and the five new unit tests fail on main and pass here, and CI is green on this head.
Optional:
- The comment at
TopNavHeading.tsx:61-62still says the text track can shrink to zero; with a menu it stops at the chevron box, and with independent links at the longest linked word. - The changeset's "ends in an ellipsis" holds for
TopNavHeading, but a plain string inheadingwraps instead; consider "…aTopNavHeadingwider than the whole bar ends in an ellipsis, and other heading content wraps…".
[Automated review]
(Posted by Cindy's agent.) Dismissing as addressed at head c30126f: the latest automated review at this head APPROVES (a heading wider than the bar now ends in its ellipsis inside the bar; the new Chromium truncation case fails on main and passes here). Earlier points are fixed at this head: end-content position, the crowded-bar overlap, the chevron minimum and the logo-only track; the crowded-heading spec now checks overlap and sideways scroll (TopNavCrowdedHeading.a11y.chromium.spec.ts); the changeset uses the reviewer's exact wording. The independent-links behavior follows the recorded TopNavHeading FR1 ruling.
Fixes #9530
User impact
On the current base (where a crowded TopNav wraps its rows), a
TopNavheading wider than the whole bar ran off the bar and scrolled the page sideways, and aTopNavHeadingset to truncate never showed its ellipsis. Now the heading ends in an ellipsis inside the bar and its logo stays whole. Independently linked lines wrap and keep their longest word; a plain line beside them still keeps its full width.Problem and solution fit
The div that wraps
headinghasflexShrink: 0, but the section that holds it (leftSection:flex: 1 1 0%,minWidth: 0) does shrink. So when the bar is tight, the section narrows and the heading keeps its full width, overflowing the section. Because nothing narrows the heading, its own truncation never triggers.Expected behavior and authority
The issue lays out the expected outcome: the heading wrapper shrinks with its section, so a heading that can truncate does so inside its column.
leftSectionalready opts in withminWidth: 0, and the wrapper was the one link in that chain that didn't.Smallest restoration
Reshaped by a maintainer (with the author's attribution kept) after review: the first version's
minWidth: 0let a crowded bar shrink the heading to nothing, logo included. The maintainers read TopNavHeading FR1 as deciding that the text column truncates first and the logo never shrinks; FR1 now says so.TopNav's heading column getsflexShrink: 1(it was0), so it can shrink with its start region, down to its own minimum.TopNavHeading's root lays out as a grid (gridAutoFlow: column, start-justified) instead of a flex row. Its narrowest size is then the logo and the controls beside the text, because the text column (minWidth: 0) adds nothing to it. A crowded bar truncates the text first and never shrinks the logo. Once only the logo is left, the start region overflows as onmain.Evidence
main(flexShrinkis'0').TopNav.test.tsx> "lets the heading column shrink so a long heading can truncate". It fails when the style change is reverted.TopNavCrowdedHeading.a11y.chromium.spec.ts(new), red onmain's TopNav 3 of 3, green on this head 3 of 3 (twice):TitleOnlyat 420 px with a long heading: onmainthe heading runs to 517 px, under the Sign in button at 327 px; here it ends at the button, truncates, and the page does not scroll sideways.FullExampleat 700 px and 600 px: onmainthe start items run past the viewport and the page scrolls sideways; here the heading text truncates, the logo stays whole and clear of the first nav item, and nothing scrolls sideways.main.TopNavMobileLongHeadingstill passes. At 390 px the crowded stories differ as intended. A heading with no logo (Default) truncates its text to nothing before the items move, as FR1's ellipsis rule allows.Scope
Testing
vitest run packages/core/src/TopNav: 161 passed.packages/coresuite: the only failures are 22 tests in 12 files outside TopNav (Button, Dialog, Popover and others). They fail the same way on an unmodifiedmainin my environment.eslint,tsc --noEmit(core) andcheck:changesetspass. The pre-commitcheck:repopasses.AI-assisted. I opened this as a draft per the contributing guidelines.
Maintainer follow-up (independent links in a crowded bar)
(Posted by Cindy's agent on her behalf.) Carried on this branch with the author's commits kept. Exact head: c30126f.
headingHrefplussuperheadingHreforsubheadingHref, nomenu), the text track (minmax(0, 1fr)) could shrink to zero. In a crowded bar both links clipped to 0 px, Tab landed on an empty focus ring, and the hidden wrapped words still made the bar taller.minmax(min-content, 1fr)(auto minmax(min-content, 1fr)with a logo), so the column keeps its longest word and a link is never clipped to nothing.main(with the TopNav row wrap) is merged in. When the start region is crowded, the row wraps before any link is clipped.Core/TopNav"Independent Heading Links".TopNavCrowdedHeading.a11y.chromium.spec.tsnow checks, on the wrapping base:FullExampleat 700, 600 and 390 px: the logo is whole, the heading's box overlaps no other control, and the page does not scroll sideways.TitleOnlyat 320 px with a heading wider than the bar: it truncates, ends inside the bar, overlaps nothing, and the page does not scroll.:focus-visiblelink.These assertions, replayed in real Chrome 157 on this branch's preview, pass in all 7 cases.
Writing rubric results
R1 narration: none; the FR1 clauses are present-tense sentences.
R2 research: none in the record.
R3 evidence: FR1 keeps its basis; the real-Chromium spec verifies both clauses (truncation first, and independent links keep their longest word).
R4 rejected alternatives: none in the record (a minimum text width or the mobile bar when crowded would be new behavior and are out of scope).
R5 change references: none.
R6 open questions: none.