Skip to content

fix(Toolbar): allow two-slot OverflowList start lane to shrink beside endContent - #11996

Closed
quocluongg wants to merge 5 commits into
meta:mainfrom
quocluongg:fix/toolbar-start-slot-overflow
Closed

quocluongg wants to merge 5 commits into
meta:mainfrom
quocluongg:fix/toolbar-start-slot-overflow

Conversation

@quocluongg

@quocluongg quocluongg commented Nov 16, 2026 •

Copy link
Copy Markdown

Fixes #8804

User impact

  • Who: Users and builders composing OverflowList inside Toolbar.startContent (or TableSelectionToolbar.startContent) alongside trailing endContent (such as a selection count and Clear button) in narrow containers, and builders placing a single-row OverflowList in any content-sized parent.
  • Before: In a two-slot horizontal Toolbar, startSlot had flex: 0 1 auto and a single-row OverflowList contributed its full rendered items' min-content width to the lane, while endSlot could shrink or wrap. The actions did not fold to fit the space beside endContent, pushing endContent past the toolbar's edge and clipping the overflow trigger and the selection count. An earlier attempt at this fix applied contain: inline-size and a rendered cap to every single-row list, which broke the default observeSelf list: it shrank to its items' span on mount (false folds), the summed rounded offsetWidth floor clipped +6 to +.., and once folded it never grew back. It also made a list add no width to a content-sized parent (an inline-block with 700 px free rendered only +6).
  • After: The horizontal two-slot startSlot takes the remaining width (flex: 1 1 0%) keeping its min-width: auto floor, endSlot keeps its natural width (flex-shrink: 0), and the row wraps (flex-wrap: wrap) when the lanes do not fit at their minimum widths. A single-row OverflowList publishes its collapsed minimum inline size, rounded up from fractional widths so the trigger fits at it. Size containment (contain: inline-size, inline-size: 100%, flex-shrink) applies only inside Toolbar's marked filling start lane, so a list anywhere else keeps its content-sized intrinsic width. An observeSelf list is never capped below the width it is given (max-inline-size: none), so it folds to fit and grows back when space returns; only an observeParent list takes the rendered cap while its items fit.

Problem and solution fit

  • Why does the defect occur? startSlot had flex: 0 1 auto, and the single-row list contributed the sum of its rendered children to the lane's min-content size without publishing its collapsed minimum, so the lane could not shrink below the unfolded actions beside endSlot.
  • Why does it harm the task? Bulk actions in TableSelectionToolbar and two-slot Toolbars fail to fold at narrow widths and push the selection summary and Clear action past the container edge, clipping the overflow trigger.
  • Why does that harm matter? It breaks narrow-viewport usability and prevents OverflowList from folding inside Toolbar.startContent without custom wrapper overrides. The narrow fix gives the lane the leftover width and floors it at the list's collapsed minimum, while scoping containment to that lane so the list's default self-measuring and content-sized behavior elsewhere are preserved.

Expected behavior and authority

  • component:Toolbar FR2: without centerContent, a horizontal Toolbar renders the present start and end lanes without clipping or overlapping, wrapping the row when the lanes do not fit at their minimum widths (spec:AST-102 FR4).
  • component:OverflowList FR2 / FR4: the list shows as many items as fit its measured width (its own under observeSelf, its parent's under observeParent); one row is a non-wrapping flex line that clips overflow; with observeParent and items collapsed it fills its parent's width. The published floor and the lane-scoped containment restore this fit inside the growing lane without changing the measured-fit contract.
  • No new public API, visual representation, or interaction model is added. The lane marker is a private internal StyleX marker (packages/core/src/internal/overflowLane.stylex.ts), not a public prop, theme target, or data-* attribute; it follows the existing shared internal markers (indicatorPress.stylex.ts, touchHitArea.stylex.ts) that several components already import.

Smallest restoration

  • packages/core/src/Toolbar/Toolbar.tsx:
    • Allow two-slot baseFlex rows to wrap (flexWrap: 'wrap') when the lanes do not fit at their minimum widths.
    • Apply startFill (flexGrow: 1, flexShrink: 1, flexBasis: '0%') on the horizontal startSlot, keeping min-width: auto; apply endKeep (flexShrink: 0) on endSlot beside startContent.
    • Mark the horizontal filling startSlot with overflowLaneMarker so a hosted single-row list isolates its intrinsic inline size there only.
  • packages/core/src/internal/overflowLane.stylex.ts (new): the shared private stylex.defineMarker() for a flex lane whose width the row gives, not its content. Toolbar marks its filling start lane; OverflowList reads it.
  • packages/core/src/OverflowList/OverflowList.tsx:
    • The single-row container takes contain: 'inline-size', inlineSize: '100%', flexShrink: 10000 only under stylex.when.ancestor(':is(*)', overflowLaneMarker); outside that lane it keeps its content-sized width.
    • Publish the bounds as direct dynamic properties via inlineBounds.publish(collapsedWidth, maxWidth): minInlineSize is the collapsed floor; maxInlineSize is the rendered span for an observeParent list while its items fit, else none. The base sets no competing min-width: 0, which would outrank a marker-gated floor because the ancestor condition compiles to :where() (a lower cascade layer).
  • packages/core/src/hooks/useOverflow.ts: track collapsedWidth (minVisibleItems plus the indicator) and renderedWidth from fractional getBoundingClientRect().width, summed and Math.ceil-ed so the floor never lands under the true span. A resize that changes the collapsed floor (it floors the marked lane) renders one frame later to avoid Chromium's ResizeObserver loop error.
  • Tests and stories:
    • OverflowList.test.tsx: published minInlineSize (ceiled from fractional widths), maxInlineSize: none for observeSelf, the observeParent rendered cap while items fit and its drop once collapsed, and no bounds for a multi-row list.
    • Toolbar.test.tsx: two-slot flex fill and row wrapping.
    • Toolbar/__tests__/ToolbarTextSize.interaction.browser.spec.ts: readLanes excludes the keyboard hint's <template> layer marker (and any popover), so the two-slot wrap test counts exactly the lanes.
    • OverflowList/__tests__/OverflowListSizing.interaction.browser.spec.ts (new): content-sized parent, observeSelf no-cap and grow-back, and a toolbar trigger staying whole while the row wraps.
    • apps/storybook/stories/Toolbar.stories.tsx: an OverflowActions composition (Badge + six-action OverflowList + Clear). apps/storybook/stories/OverflowList.stories.tsx: the ContentSizedParent indicator is a short +N.
  • .changeset/toolbar-lets-its-two-slot-start-lane-shrink-belo-blog.md: [fix] patch for @astryxdesign/core.

Evidence

  • Reproduction before the change: an unconditional contain: inline-size + rendered cap on every single-row list folded a default observeSelf list on mount, clipped +6 to +.. at a floor summed from rounded offsetWidths, never grew back after a fold (Resizable 500→220→500 stayed folded), and rendered only +6 in an inline-block with 700 px free where the base shows all six actions.
  • Result after the change (real browser, OverflowListSizing.interaction.browser.spec.ts, Chromium, 7 tests):
    • Content-sized parent: contain: none, all six labels Save…Delete, parent width > 300 px — the list sizes the shrink-to-fit parent to its items.
    • observeSelf that fits (NoOverflow): Edit, Save, max-inline-size: none. DynamicItems: all five items, max-inline-size: none.
    • observeSelf grow-back (Resizable): 500→220 folds, 220→500 returns the exact wide label set.
    • Toolbar trigger whole at 240 px and 215 px: full +N label (/^\+\d+$/), scrollWidth <= clientWidth + 1, list width >= trigger width, the 5 selected badge whole beside it, and no sideways page scroll.
    • Toolbar grow-back: 240→900 shows Save and Delete again.
  • Representative unchanged path: three-slot Toolbar (center at the middle, no lane overlap at 165% / 194% text size), the bottom-divider tab indicator on the rail, multi-row OverflowList, and vertical stacking are unchanged (ToolbarTextSize.interaction.browser.spec.ts, Chromium, 7 tests).
  • Regression test / mutation-sensitive proof: the two new browser specs above plus the published-bounds unit tests. Re-adding a base min-width: 0, capping an observeSelf list, or applying containment outside the marked lane fails the content-sized-parent, grow-back, or trigger-whole assertions.

Scope

Components: Toolbar, OverflowList

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run --project ui packages/core/src/OverflowList packages/core/src/Toolbar — 87 passed (OverflowList 40, Toolbar 39, Toolbar a11y 8).
  • pnpm vitest run --project ui packages/core/src/hooks/useOverflow.test.ts packages/core/src/hooks/computeOverflow.test.ts packages/core/src/Table/TableSelectionToolbar.test.tsx — 90 passed.
  • pnpm exec playwright test --config playwright.interaction.config.ts --project=chromium OverflowListSizing ToolbarTextSize — 14 passed.
  • ASTRYX_STRICT_LINT=1 pnpm exec eslint on every changed source, test, and story file — clean.
  • pnpm exec prettier --check on every changed file — clean.
  • pnpm -F @astryxdesign/core typecheck — clean.
  • pnpm check:repo — exit 0.
  • pnpm review:pre — exit 0, 0 findings.

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 16, 2026 1:51pm UTC

Request Review

@meta-cla

meta-cla Bot commented Nov 16, 2026

Copy link
Copy Markdown

Hi @quocluongg!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 19, 2026, 7:51 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for tracking this down. The reported TableSelectionToolbar row with an OverflowList now folds at narrow widths and grows back, but a few changes are needed before this can merge:

  • Start-lane controls overlap the end lane: the start lane can now shrink to zero beside an end lane that never shrinks, so in the Toolbar "Composition: Bulk Selection" story at a 220 px viewport the Archive button slides under "Deselect all", a click on Archive clears the selection, and the "5 selected" badge loses its text.
  • Growing back raises a ResizeObserver loop error: useOverflow defers a fold that changes the list's fill only for observeParent, so once the list fills its parent in observeSelf mode, every grow back makes Chromium report "ResizeObserver loop completed with undelivered notifications" (please revert the OverflowList change and use behavior="observeParent", which already grows back once the lane can shrink).
  • End-only toolbars change too: minWidth: 0 on the end lane does nothing beside a start lane, but it lets narrow end-only toolbars cut their button labels ("C…", "Sav…", "Pu…" in a 200 px box), so please remove it.
  • The description misstates the OverflowList contract: it says the list fills its parent whenever items collapse, but the contract applies that fill only with observeParent, and the narrow-layout changes above are not mentioned in the description or the changeset.

A browser check with ordinary Buttons in the start lane would show that the fix holds for both kinds of start content.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Changeset: the two-slot start lane shrinks so OverflowList actions collapse beside the end content and expand again. Verified for an OverflowList start lane (folds to Save, Edit, +4 at 380 px; all six at 800 px); each grow back raises a ResizeObserver loop error.
  • Before: the start lane floored at its content width, so the actions did not fold and the end content spilled and wrapped. Verified (at 380 px the base shows all six actions, and the end lane runs past the box).
  • Before: a collapsed list in self-observing mode kept its collapsed width as the toolbar widened. Verified from the code: the base applies the fill only with observeParent.
  • After: the start lane takes the remaining width and the end lane keeps its natural width, without clipping focus rings. The declarations are verified and no slot clips, but the claim that no lane overlaps another is false for ordinary start controls.
  • After: the list fills its parent while collapsed and drops the fill once every item fits. Verified (100% at 380 px; 415.8 px content width at 800 px).
  • The cited OverflowList contract fills the parent whenever items collapse. False: the contract limits the fill to observeParent.
  • No new public API. Verified: the API surface comparison shows 0 changed rows for Core and the themes.
  • No hidden visual change or default. False for narrow two-slot and end-only layouts.
  • Three-slot layout, slot clipping and vertical stacking are unchanged. Verified: the three-slot story is pixel-identical, and the new min-width is overridden in the side lanes and inert in vertical rows.
  • The named regression tests exist and guard the change. Verified: all three fail on the base and pass on the head.
  • The listed Vitest runs pass. Verified for the five related test files (135 tests).
  • .changeset/toolbar-lets-its-two-slot-start-lane-shrink-belo-blog.md: omits the narrow-layout changes.
  • packages/core/src/Toolbar/Toolbar.tsx: start-lane overlap; end-lane tagalong.
  • packages/core/src/OverflowList/OverflowList.tsx: ResizeObserver loop error on grow back.
  • packages/core/src/Toolbar/Toolbar.test.tsx: clear.
  • packages/core/src/OverflowList/OverflowList.test.tsx: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved
Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved
@meta-cla

meta-cla Bot commented Nov 16, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@meta-cla

meta-cla Bot commented Nov 16, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@quocluongg quocluongg changed the title fix(Toolbar, OverflowList): allow two-slot start lane to shrink and grow OverflowList beside endContent fix(Toolbar): allow two-slot OverflowList start lane to shrink beside endContent Nov 16, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick turnaround: start lanes that cannot fold now wrap instead of sliding under the end lane, the OverflowList change is reverted, and end-only toolbars are unchanged. A few changes are still needed before this can merge:

  • The overflow trigger gets cut at narrow widths: because the start lane's minimum drops to 0 whenever it contains an OverflowList, a TableSelectionToolbar row with six actions narrows that lane to 32 px in a 240 px container and 7 px at 215 px, so the "+6" trigger shows only a "+" and then disappears instead of the row wrapping as Toolbar's layout contract asks (a Badge beside the list truncates the same way).
  • The trailing-edge placement for a wrapped end lane has no effect: edgeCompSlot.inset, passed after styles.endOnly, redefines marginInlineStart, so StyleX drops the auto and a wrapped end lane ("Deselect all" in the Bulk Selection story at 220 px) starts at the leading edge, contrary to the new comment.
  • The changeset and description overstate the fix: "expand again when space returns" holds only with behavior="observeParent" (the default observeSelf used in #8804 stays at Save, Edit, +4 after widening to 800 px), the released Toolbar pushed end content past the edge rather than overlapping it, and on the base the start lane never narrowed, so "could not grow back" is not the cause.

A browser check at those narrow widths would guard the wrap.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Changeset: a start lane holding an OverflowList shrinks so the actions collapse beside the end content. Verified: Save, Edit, +4 at a 380 px container.
  • Changeset: the actions expand again when space returns. Verified with observeParent (all six at 800 px); false with the default observeSelf, which stays folded.
  • Changeset: fixed start lanes wrap instead of overlapping the end content. The wrap is verified (Bulk Selection at 220 px); the previous behavior was not overlap but end content past the edge.
  • Before: the start lane kept its content width, so the actions did not fold and the end content was pushed past the edge. Verified (end lane to 653 px at 380 px).
  • Before: the end lane could shrink or wrap. Verified (the selected count wrapped onto two lines).
  • Before: the start lane never expanded back when the toolbar widened. False: the base lane never narrows; its minimum is the cause.
  • After: the list lane takes the remaining width without a minimum, the end lane keeps its width, and end-only toolbars keep full labels. Verified (computed styles; the end-only frame at 200 px is identical).
  • After: start lanes that cannot fold keep their minimum and the row wraps. Verified at 220, 230 and 300 px.
  • After: the end lane is pushed to the trailing edge when alone on a line. False: the clause has no effect.
  • With observeParent the actions fold and grow back without ResizeObserver errors. Verified over two 380/800 px cycles; one large single-step fold logged the loop message the OverflowList contract already documents.
  • The two-slot lanes render without clipping or overlapping. False between about 205 and 250 px, where the trigger is cut.
  • Three-lane layout, slot clipping, OverflowList and vertical stacking are unchanged. Verified (code untouched; vertical frame identical).
  • No new public API. Verified: the built API surface is identical.
  • The listed tests pass. Verified: 136 tests in five files; lint and formatting are clean.
  • .changeset/toolbar-lets-its-two-slot-start-lane-shrink-belo-blog.md: overstates grow-back and the previous behavior.
  • packages/core/src/Toolbar/Toolbar.tsx: trigger cut below the fitting width; inert trailing-edge clause.
  • packages/core/src/Toolbar/Toolbar.test.tsx: clear (three of the four new tests also pass on the base).

Automated review (maintainer link)

Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved
Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the trigger floor: a start lane that holds only an OverflowList now folds at 380 px and wraps at 240 and 215 px with every control whole, and the earlier endOnly and changeset points are resolved. A few changes are still needed:

  • The floor goes stale when the start content changes: syncStartSlotFloor runs only when the row or the list's measure copy resizes, and the attachment key leaves out the start content, so a lane that gains its OverflowList after mount keeps a floor of 0 (the "+6" trigger shows as "+." in a 240 px box) and a badge that grows keeps the old floor (Edit and "+4" disappear) until the toolbar is resized.
  • A Badge directly beside an observeParent list crushes the actions: OverflowList sizes an observeParent list from its parent's whole width, so with the badge pinned at flex-shrink: 0 the composition in the new floor test and in the description's Badge evidence shows "S…", "E…", "Dupli…" and "+." at 380 px and blank buttons at 240 px, which makes the description's "zero truncation" and "completely uncut" claims false; the list in its own flex: 1 1 0%; min-width: 0 wrapper, or with observeSelf, keeps every label whole.
  • The floor measurement interleaves layout reads with style writes: inside the row's ResizeObserver callback each sibling's maxWidth is set to none, read with getBoundingClientRect() and restored, so every resize frame forces extra synchronous layouts, which the component runtime's layout-read rule does not allow.
  • Toolbar re-measures the OverflowList indicator on its own: it walks into OverflowList's private measure copy and observes it although useOverflow already measures that indicator (and, unlike this copy, does not take the last item for the indicator when there is no overflowRenderer), so the floor should come from OverflowList itself, for example as its own minimum inline size, which also removes the two points above.

A two-slot case in the Toolbar text-size browser test would guard the wrap geometry.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Changeset: a start lane holding an observeParent OverflowList shrinks so the actions collapse beside the end content. Verified: Save, Edit, +4 at a 380 px box.
  • Changeset: the actions expand again when space returns. Verified: all six at 800 px.
  • Changeset: fixed start lanes wrap onto a new line instead of pushing the end content past the edge. Verified: the Bulk Selection story at 220 px.
  • Before: the start lane kept its content width, the actions did not fold, the end content went past the edge and the count wrapped. Verified: the end lane ran to 652 px at a 380 px box, with the count on two lines.
  • After: the start lane takes the remaining width and floors at the trigger plus non-folding siblings. Verified from mount (41 px; 118 px with a badge); false after the start content changes, where the floor stays stale.
  • After: the end lane keeps its width beside a start lane, and end-only toolbars keep their minimum. Verified in the code and tests.
  • After: the row wraps instead of pushing the end content past the edge or cutting the trigger and siblings. Verified for a list-only lane at 240 and 215 px; false after a content change and for a badge beside an observeParent list.
  • After: observeParent lists grow back and observeSelf lists stay folded. Verified for observeParent; observeSelf follows its own measured width.
  • Evidence: with a badge beside the list, the badge keeps its width with no truncation. The badge is whole; false for the actions and the trigger, which are cut at 380, 240 and 215 px.
  • Evidence: a narrow end-only toolbar keeps full labels. Verified: the end-only path is unchanged.
  • Unchanged: the three-lane layout, OverflowList and vertical two-slot stacking. Verified.
  • No new public API. Verified: the built API surface is identical.
  • The listed tests, lint, formatting and typecheck pass. Verified: 136 tests in five files.
  • .changeset/toolbar-lets-its-two-slot-start-lane-shrink-belo-blog.md: clear.
  • packages/core/src/Toolbar/Toolbar.tsx: stale floor; interleaved layout reads; duplicated indicator measurement.
  • packages/core/src/Toolbar/Toolbar.test.tsx: the floor test uses the badge composition that crushes the actions, and reaches a recalculation only through a gap change.

Automated review (maintainer link)

Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved
Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved
Comment thread packages/core/src/Toolbar/Toolbar.tsx Resolved

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for moving the floor into OverflowList: Toolbar no longer observes or walks the list, the two-slot row wraps before the trigger is cut, an observeParent list folds at 380 px and comes back at 800 px, and every earlier point on this pull request is resolved. Two changes to OverflowList itself still need work:

  • The rendered-width cap breaks default observeSelf lists: setting max-inline-size to the span the list last rendered (OverflowList.tsx:427-430) hides items that fit (the NoOverflow story shows only "+2 mo…" in a 582 px row), cuts the trigger in #8804's own toolbar ("+.." instead of "+6" at 240 px) and keeps a folded list folded when space returns (the Resizable story stays at Dashboard, +6 more after 500 → 220 → 500 px), so the description's "no default hidden under the bug-fix label" does not hold yet.
  • Size containment folds a list in a content-sized parent to its trigger: with contain: inline-size and inline-size: 100% on every single-row list (OverflowList.tsx:45-46), a list inside an inline-block with 700 px free renders only "+6", where the base renders all six actions.

Never capping an observeSelf list below the width it is given, rounding the published floor up, and scoping the containment to Toolbar's growing start lane would address both, and a browser test that mounts NoOverflow and shrinks and then widens Resizable would guard them.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Changeset: the horizontal two-slot start lane takes the remaining width. Verified: the Bulk Selection start lane spans 1,100 px at 1,280 px.
  • Changeset: the two-slot row wraps at narrow widths. Verified: Bulk Selection at 220 px and the selection toolbar at 215 px.
  • Changeset: a single-row OverflowList publishes its collapsed minimum inline size. Verified: 64 px for the "+6" trigger.
  • Changeset: overflowing actions collapse beside the end content without clipping the trigger or siblings. Verified for observeParent; false for the default observeSelf, where the trigger reads "+.." at 240 px.
  • Before: the start lane kept its content width and pushed the end content past the edge. Verified: 565 px of content in a 356 px row at 380 px.
  • After: the start lane fills with an automatic minimum, the end lane keeps its width, and the row wraps. Verified in the code and the browser.
  • After: OverflowList isolates its intrinsic size and publishes its minimum and its rendered bound, so Toolbar needs no observer or DOM walk. Verified for Toolbar; the rendered bound and the containment cause the two findings.
  • After: a sibling that grows, or a list mounted later, updates the lane minimum at once. Verified for a growing badge; a later mount is measured in its mount commit.
  • Evidence: at 380 px the list folds beside the count and Clear. Verified: Save, Edit, +4.
  • Evidence: at 240 and 215 px the row wraps and keeps two actions and the trigger whole. Verified at 215 px; at 240 px a narrower end lane keeps one row and the list folds to its trigger, which the layout contract allows.
  • Evidence: at 800 px an observeParent list shows all six and an observeSelf list stays folded. Verified; the second is the first finding.
  • Evidence: a badge beside an observeSelf list stays whole when it grows. Verified for the badge; the trigger beside it is cut (first finding).
  • Evidence: the Bulk Selection story at 220 px puts Deselect all on a second row with no overlap. Verified.
  • Evidence: a narrow end-only toolbar keeps its full labels. Verified: the end-only path is unchanged and its story renders identically.
  • Unchanged: the three-lane layout, multi-row OverflowList and vertical two-slot stacking. Verified: their stories render identically, and the vertical test passes.
  • No new public API. Verified: the built API surfaces are identical.
  • No new default or visual change is hidden under the fix. False: both findings change every single-row OverflowList.
  • The public text carries no internal context. Verified.
  • The listed tests, lint, formatting and Core typecheck pass. Verified: 347 tests in seven files, strict lint, Prettier and the typecheck.
  • The repository checks and the pre-review script pass. Not checked here: both need a git working copy.
  • .changeset/toolbar-lets-its-two-slot-start-lane-shrink-belo-blog.md: its trigger claim is false for observeSelf (first finding).
  • packages/core/src/OverflowList/OverflowList.tsx: both findings.
  • packages/core/src/OverflowList/OverflowList.test.tsx: clear; no case covers either finding.
  • packages/core/src/Toolbar/Toolbar.tsx: clear.
  • packages/core/src/Toolbar/Toolbar.test.tsx: clear.
  • packages/core/src/Toolbar/__tests__/ToolbarTextSize.interaction.browser.spec.ts: clear.
  • packages/core/src/hooks/useOverflow.ts: computes the rendered bound behind the first finding.

Automated review (maintainer link)

A single-row list took contain: inline-size and a rendered cap everywhere,
which broke the default observeSelf list: it folded on mount, clipped the
trigger at a floor summed from rounded offsetWidths, and never grew back.
It also added no width to a content-sized parent.

Containment now applies only under a private lane marker that Toolbar sets
on its filling start lane, so a list elsewhere keeps its intrinsic width.
The collapsed floor and rendered bound publish as direct properties (a base
min-width: 0 would outrank a marker-gated floor through StyleX's :where()
cascade layer) and round up from fractional widths so the trigger fits. An
observeSelf list is never capped, so it grows back when space returns.
cixzhang added a commit that referenced this pull request Nov 19, 2026
…ide the end lane (#12238)

* fix(Toolbar, OverflowList): a start lane's own OverflowList folds beside the end lane

A horizontal two-slot Toolbar sized its start lane from its content, and
its automatic minimum counted an OverflowList's unfolded items. The list
then never saw a narrower width, so it never folded, and the end lane was
pushed past the toolbar's edge.

When the start lane holds an OverflowList as its own child
(:has(> .astryx-overflow-list)), it takes the width the end lane leaves
(flex 1 1 0%) and drops its automatic minimum, so the list folds to fit.
A lane whose list sits deeper, such as the table filter template's, keeps
its layout. A single-row OverflowList publishes a minimum width of its
folded set, measured from sub-pixel widths and rounded up, and never wider
than its items, so a squeezed row keeps its trigger whole and a list with
room is unchanged.

Fixes #8804. Supersedes #11996.

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): a folded list unfolds into its flex row's free width

In a single flex row a folded list is as wide as its folded items, so its
own width never showed room returning, and it stayed folded after the row
widened. A single-row list in such a row now adds the row's free width
(the row's content width less its in-flow children and gaps) to its own,
and also observes the row, so a widening row lets it unfold.

The browser spec measures lanes from their own children, takes the frame's
edge as the limit (edge compensation reaches into the toolbar's padding),
handles a toolbar with one lane, and adds a widen-after-fold case.

Co-authored-by: quocluongg <[email protected]>

* test(Toolbar): the table filter template shows every clause at 1280 px

A start-only toolbar's lane is flex 1 1 0% on main too, so the spec now
checks the template's clauses, all shown at desktop width, instead of the
lane's basis.

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): lists in one flex row share its free width

Each single-row list in a flex row added the row's whole free width to its
own. Two lists in one row then both unfolded into the same space, the row
overflowed, both clipped, the next measurement folded them, and the cycle
repeated every frame. The lists that may unfold into a row now split its
free width, so together they never claim more than it.

The public useOverflow no longer returns the internal inline bounds. A
Toolbar story holds two lists as the start lane's own children, and the
browser spec checks that they settle without clipping or flicker at 380,
530 and 900 px.

Co-authored-by: quocluongg <[email protected]>

* test(Toolbar): two lists in one row both fold at 380 px and stay folded

The no-clip, no-flicker cases pass on main too, since main never folds.
This case needs both lists to fold into their own triggers beside the end
lane, without clipping and steady across frames: main fails it (no fold),
and so did the head before the lists shared the row's free width (flicker).

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): the inline floor never widens a list with room

The floor is the smaller of the folded and unfolded widths. Both were
rounded up, so a list whose items span a sub-pixel width (a one-item list
of 42.7 px) grew to the next pixel. Only the folded width now rounds up, so
its trigger never clips; the unfolded width stays exact. The browser spec
checks the one-item list's width to a tenth of a pixel.

Co-authored-by: quocluongg <[email protected]>

* docs(OverflowList): FR4 states a single row's minimum inline width

A single row is never narrower than the smaller of its fully folded width
and its unfolded width, so its indicator is never clipped. In a narrower
parent the list overflows the parent, and the parent's own overflow decides
what shows. Browser cases cover a list in a parent narrower than its folded
width (indicator whole) and a list with room (floor no wider than its
items).

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): the free-width sharer set is shared across copies of Core

The set of lists that share a row's free width was module-scope state, so a
second copy of Core (a swizzled OverflowList) kept its own set and two lists
from different copies in one row would each claim the whole free width. It
now lives in the realm value 'overflow/free-width-sharers' v1. The inline
bounds doc states that only the folded width rounds up.

Co-authored-by: quocluongg <[email protected]>

* docs(Toolbar): FR2 names a lane's minimum width, an OverflowList's folded

Toolbar FR2 wraps the row when the lanes do not fit at their minimum widths.
It now states that a lane's minimum width is its content's minimum, and an
OverflowList's is its folded width (OverflowList FR4), so the list folds
before the row wraps. The FR2 verification table names the overflow-list
browser spec, which gains a case where the folded start lane and the end
lane still exceed the row at 160 px: the end lane moves to a new line.

Co-authored-by: quocluongg <[email protected]>

* docs(Toolbar): record the narrow-row overlap of a folding start lane as an FR2 gap

At its folded content width (about 135 px in the overflow-actions story) a
start lane holding an OverflowList overlaps the end lane rather than
wrapping, because the lane cannot read the list's folded minimum. FR2's rule
stands; Toolbar's current-state impact lists the gap, and the 320 px
no-overlap test guards the supported range. The FR2 sentence about a lane's
minimum width is removed, and the 160 px wrap case is dropped: at 160 px the
folded start lane and the end lane fit on one line.

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): a list with a set or capped width takes the row's free width only up to its own limit

A single-row list in a wider flex row added the row's free width even when
the caller set its width or capped it with max-width. It then measured
room it could not take, rendered every item, and lost its trigger. The
share is now clamped to the room the list's box can widen: up to its
max-width, and none when its width is set. A story with a set and a capped
width, and a browser case, cover it.

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): round the row share once, and give no share to a list its items do not size

A single-row list added its floored share of the row's free width to its
rounded offsetWidth. At the edge of its share the two roundings traded off,
and the list folded and unfolded each frame (565 px for the overflow-actions
story, 597 and 901 px for two lists). The share now goes on the list's
sub-pixel width and rounds once.

Where Typed OM is missing (Firefox) a caller width could not be read, so a
list with width: 200px still claimed the row's free width and squeezed its
items. A list now takes a share only when it shows its items at their own
widths; a set width or a squeeze gives no room. Frame-sampling cases at the
edge widths cover the first; the caller-limited case covers the second in
Firefox.

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): unfold from the start or at the floor, and give no share to a non-pixel cap

The share gate read the list's last child as its indicator, but a list that
collapses from the start renders the indicator first, so it compared the
wrong width and never unfolded once folded. A list at its min-width floor
is wider than its shown items by design, which the gate read as a set
width. Both now count as sized by their items: the indicator is read from
the side it renders on, and a box at its floor passes.

A max-width the computed style keeps unresolved (a percentage, calc(),
min()) read as NaN and granted unlimited room, so a list capped with
calc(25% + 30px) flipped between folded and squeezed most frames. Such a
cap now gives no share.

The RowWidensAfterFold story and a browser case unfold a start-collapsing
list and a minVisibleItems list after a narrow row widens; the caller-limited
story gains a calc() row with a frame-sampling case. Both fail at the
previous head in Chromium and Firefox.

Co-authored-by: quocluongg <[email protected]>

* refactor(OverflowList): a single row owns its width; no share math

Rebuilds the fold on one contract the list owns in its own CSS, replacing
the measured share of a flex row's free width. A single-row list without
observeParent publishes its unfolded width as its width, at most its
parent's (max-width: 100%), and its fully folded width as its min-width. A
flex row shrinks it toward that minimum, it folds against the width it gets,
and it unfolds as room returns. A caller's width, max-width, calc() or min()
cap, or flex basis replaces the published width by the cascade, so the
list folds inside it; one narrower than the folded width holds the folded
width with its trigger. The share helpers and the row observer are gone.
Toolbar's start lane keeps its plain CSS (flex 1 1 0%, min-width 0).

The fit uses sub-pixel item widths in the list's sub-pixel content box, so
a box at the published width holds every item, and it fits a set whose last
item is narrower than the indicator without reserving the indicator (a
start-folding list could stay folded at its full width).

New cases: flex-basis and width rows narrower than the folded width, a
plain-text indicator that unfolds on widen, and a list followed by a button
(the button stays whole after the list's width). Chromium and Firefox pass.

Co-authored-by: quocluongg <[email protected]>

* fix(OverflowList): publish the unfolded width only in a flex row

In a block, grid, or column parent the list's width stays automatic, so it
fills the line as it did before; only in a flex row, where its width would
follow its folded content, does it publish its unfolded width. The parent's
layout is read at every measurement, in the existing measurement path, and
the list now also measures when its parent resizes, so a parent that
switches between a flex row and a block across a breakpoint is followed.
Nothing is read before the first client measurement, so the server markup
is unchanged. A block-parent case and a display-flip case cover both.

* Merge main into fix/toolbar-overflowlist-shrink

* fix(OverflowList): fold before a sibling in the row shrinks

In a flex row the list's published width made it a large flex basis, so
its siblings shrank with it: the Toolbar's "5 selected" badge was cut to
"5 s…" at 380 px and a button after a list to "A…". The list's shrink
factor now dwarfs its siblings', so a sibling gives up less than a layout
unit until the list reaches its folded minimum. Label-level cases (no cut
text beside the list in the start lane at 380 px; the following button's
label whole at 900, 300 and 900 px) fail before and pass after, in
Chromium and Firefox.

* fix(OverflowList): publish sizes in layout pixels and only for the items the cap allows

Under a scaled ancestor the list read screen-pixel widths, so a row scaled
to one half folded with room for every item and published half its
trigger's width as its floor. Widths now divide by the scale the measure
copy shows. A list with maxVisibleItems published every item's width,
leaving blank space after its trigger; its width is now the items the cap
allows plus the indicator. The OverflowList record's compatibility lines and
PR1 name the published sizes and the parent observation, and two long
record sentences are split. A scaled-row story and a capped row, each with
a browser case, cover both.

* fix(OverflowList): ignore offsetWidth rounding when reading the layout scale

offsetWidth rounds to a whole pixel, so on a narrow measure copy its ratio
to the sub-pixel width read as a small scale and shifted a one-item list's
published width and floor in Firefox. A difference within one pixel now
reads as no scale.

* test(OverflowList): the scaled-row case checks that the trigger's label renders whole

The case checked only that the trigger stayed inside the list, so it passed
on main, where the trigger shrinks inside the list and paints a lone "+".
It now also fails when a label inside the trigger is cut short. It fails on
main and passes here, in Chromium and Firefox.

* refactor(core): one shared screen-scale read for hit areas and OverflowList

OverflowList's own scale read divided by the measure copy's whole-pixel
offsetWidth, so its scale drifted with how that width rounded. hitArea's
screenScale already reads the exact layout size from the computed style;
it moves to utils/screenScale.ts and takes its pixel tolerance from the
caller. Hit areas keep their one-pixel shortcut. OverflowList passes 0 and
reads the visible list, whose box has a height, unlike the zero-height
measure copy. New browser cases: a list under scale(0.5) at exactly its
width across fractional widths, and a list that measures inside a box at
scale(0.9) and keeps every item after the scale ends.

* refactor(OverflowList): keep the scale read private to useOverflow

A shared screenScale module would be a new internal module other
components import, which needs an owner decision. hitArea.ts keeps its
private screenScale unchanged, and useOverflow gets its own exact-ratio
read, inlineScale, with a SYNC note naming the hit-area read. The two
differ in tolerance: hit areas take a one-pixel shortcut, the list always
reads the exact ratio.

* fix(OverflowList): apply a scale however close to 1 it is

inlineScale read any ratio within a thousandth of 1 as unscaled, so a list
that measured in the last frames of a layer scaling in (0.999 to 0.9999)
published a width about 0.2 px short and folded its last item once a
resize rounded past it. Only a difference within the computed width's
thousandth-of-a-pixel serialization now reads as no scale. A browser case
measures under scale(0.9995) and checks the published width matches the
unscaled one; it fails before and passes after, in Chromium and Firefox.

* refactor(OverflowList): read the list's scale through hitArea's screenScale

hitArea.ts already owns the screen-scale read, so it now exports
screenScale with a tolerance parameter and useOverflow calls it; the
private copy is gone. Hit areas keep their tolerance (a one-pixel shortcut
and a thousandth of a ratio). The list passes no pixel shortcut and a
relative tolerance of six millionths, inside the computed width's six
significant digits: the earlier 0.0005 px gate was finer than that
rounding, so in Chromium a list wider than 1000 px re-measured every frame.
A WideRow story and a browser case sweep a wide list's width and check that
its attributes hold still; the case fails before and passes after in
Chromium.

* fix(OverflowList): under a scale, read item widths from layout, not the scaled rect

A scaled rect is rounded on screen, so a width divided by the scale could
come out a layout unit short. The list then published a width a unit
narrower than its items, and an item shrank below its text: Firefox cut
'Save' and 'Duplicate' with an ellipsis under scale(0.5), and folded
'Delete' after a scale-in from 0.9. Under a scale, an item's width now
comes from its computed style, through a new layoutSize helper that
hitArea's screenScale also uses, plus half of the serialized width's last
digit so the sum is never short. A browser case sweeps letter-spacing
under scale(0.5) and scale(0.9) and checks that no item is narrower than
its text; it fails at the previous head in Chromium and Firefox and passes
here.

* Merge main into fix/toolbar-overflowlist-shrink

# Conflicts:
#	docs/specs/components/Toolbar/Toolbar.spec.md
#	packages/core/src/OverflowList/OverflowList.tsx
#	packages/core/src/hooks/useOverflow.ts

* fix(OverflowList): a single row's own width uses the gap the browser draws

Main now reads the gap a list renders (the computed column-gap of its
measurement copy) for the fold. The width a single row publishes for
itself still summed its items with the fixed gap table, so in a theme
whose gap step draws wider (matcha, y2k: 12 px for step 2) the list
published a width narrower than its items and folded one with room. It
now sums them with the drawn gap. A browser case in matcha checks the
list shows all six items with none narrower than its text and a width
that holds its drawn gaps; it fails with the table gap (five items) and
passes here.

* fix(Toolbar): a start lane holding an OverflowList keeps the row beside the two-lane wrap

Main's two-lane wrap gives the end lane flex-grow 1 and the start lane
flex-wrap: wrap. With a start lane that folds its OverflowList
(flex 1 1 0%), the lanes then split the row's free space, and the
wrapping start lane moved the list, at its unfolded width, to a line of
its own: the badge sat above the actions and the list folded with room.
Such a lane now takes all the free space (flex-grow 1000000) and does
not wrap, so the end lane stays at its content width and the list folds.
Two-lane rows without a list keep the wrap. A browser case checks the
overflow-actions toolbar at 1280 px in Y2K and matcha and at 390 px in
neutral: badge and list on one line, the end lane at its content width,
and every action shown at 1280 px; it fails at the previous head and
passes here.

* fix(Toolbar): a two-lane start lane keeps main's wrap and width unless it holds a list

The start-lane fold's style set flex-wrap and min-width to null outside
its :has() condition, and it came after the two-lane style, so it dropped
the two-lane start lane's wrap and fit-content width from every two-lane
toolbar, list or not. A two-lane start lane now takes one merged style:
wrap and fit-content by default, and only under the :has() condition
nowrap, min-width 0, a 0% basis and the large grow. Other start lanes keep
the original fold. A browser case reads a two-lane start lane without a
list (fit-content, wrap, no grow); it fails at the previous head
(min-width auto) and passes here. The 900 px and widen cases, and the
wide-theme case at 1280 px, now also fail when a +N trigger shows,
since the label count includes it.
@cixzhang

Copy link
Copy Markdown
Contributor

(Posted by Cindy's agent.) Thank you, @quocluongg. Your fix for the Toolbar start lane is now on main as part of #12238, which folds an OverflowList in a toolbar's start slot into its overflow trigger beside the end content instead of pushing that content past the edge. #12238 carries your commit credit (Co-authored-by) and names you in its release note. This PR was closed in favour of #12238.

This branch was successfully deployed

1 active deployment
Preview — 6940e530 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Toolbar start slot prevents OverflowList actions from shrinking beside end content

3 participants