Skip to content

fix(Breadcrumbs): the menu crumb's menu slides in from the crumb in published builds - #12784

Closed
josephfarina wants to merge 1 commit into
mainfrom
rl-56-4-crumb-menu-offset
Closed

josephfarina wants to merge 1 commit into
mainfrom
rl-56-4-crumb-menu-offset

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

User impact

In an app built from the published package, a Breadcrumbs menu crumb's menu opens flush against the crumb and pops in without its entrance slide. Other layered menus (DropdownMenu, ContextMenu, Selector) slide in from their trigger. In the repository's Storybook the bug is hidden, because Storybook resolves StyleX merges in application order while the published CSS uses property specificity.

Problem and solution fit

  1. Why is the menu flush? The crumb set its gap to the trigger with marginBlock in the surface's layer style. The layer's own styles set the longhands: marginBlockStart: 0 and a far-edge gutter on marginBlockEnd. Under property-specificity resolution a longhand beats a shorthand whatever the merge order, so the gap became 0.
  2. Why is there no slide? The layer runtime measures the room between the layer and its trigger and caps the entrance step at that room. With no room, the step is 0, so the first frame does not move the layer.
  3. Why does it matter? The entrance shows where a menu comes from; the crumb was the only menu that lost it. Under application order the same shorthand instead overwrote the far-edge viewport gutter.

The fix passes the gap as the layer's offset, as DropdownMenu does. offset sets the placement-axis margins and keeps them through a flip, and it leaves the far-edge gutter in place under both resolutions.

Expected behavior and authority

  • The layer runtime's offset option is the documented way to give a layer clearance from its anchor ("Layers sit flush by default ... clearance is a deliberate choice per surface").
  • LayerEntranceSide.interaction.browser.spec.ts already claims the Breadcrumbs menu crumb's entrance moves toward its trigger, with room and with no room on its side.

Smallest restoration

One option moves from a margin in the surface style to the layer's offset. No API, visual default, or interaction model changes; the gap stays --spacing-1.

Evidence

  • Reproduction before the change: Storybook built with property-specificity resolution (no styleResolution override), LayerEntranceSide.interaction.browser.spec.ts: both Breadcrumbs cases fail ("the first frame moves the layer toward its trigger (translate 0, 0)"), every repeat.
  • Result after the change: the same spec passes 20/20 under property-specificity and 20/20 under application order; the Breadcrumbs cases pass 30/30 repeats under each.
  • Representative unchanged path: the DropdownMenu, submenu, ContextMenu, Selector, Tooltip and HoverCard cases of the same spec stay green under both resolutions.
  • Regression test or other mutation-sensitive proof: a new Breadcrumbs unit test checks that the menu layer carries the layer clearance; it fails on the old source and passes with the fix.

Scope

Components: BreadcrumbItem

  • 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

  • CI=1 pnpm exec vitest run packages/core
  • pnpm test:interaction --project=chromium packages/core/src/Layer/__tests__/LayerEntranceSide.interaction.browser.spec.ts against Storybook built with each resolution
  • pnpm check:changesets

preflight: pass d97f6e2 (manual)

The menu set its gap to the trigger with a marginBlock on the layer. The
layer zeroes marginBlockStart and sets a far-edge gutter on marginBlockEnd.
Under property-specificity resolution, the published one, the longhands win,
so the menu sat flush on the crumb, the entrance measured no room and took
no step. Under application order the shorthand instead overwrote the
far-edge gutter. The offset option sets both margins and keeps them through
a flip, as DropdownMenu does.
@vercel

vercel Bot commented Nov 19, 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 19, 2026 1:38am UTC

Request Review

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

astracat-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 2:04 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · d97f6e2

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

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

Approved pending CI: CI has not run on this head yet, because the pull request is a draft and CI runs once it is marked ready.

The menu crumb's menu now takes its gap through the layer's offset, which restores the 0.25rem gap and the entrance slide under StyleX's default resolution and keeps the viewport gutter on the far edge under application order; the new unit test fails without the fix and passes with it. There are no blocking findings.

  • Non-blocking: the new comment at BreadcrumbItem.tsx lines 747–748 packs two topics into one sentence; see the inline suggestion.
Claims and files checked

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

  • Claim: the menu keeps its gap below the crumb in published builds — verified (default-resolution probe: 0px on the base, 4px on the head; BreadcrumbItem.tsx:749).
  • Claim: the menu slides in from the crumb again in published builds — verified (first entrance frame: no travel on the base, 4px toward the crumb on the head; the slide shipped in 0.7.14 and stopped for flush layers in 0.7.16).
  • Claim: the menu keeps the viewport gutter on its far edge — verified (16px far margin on the head under both resolutions; 4px on the base under application order).
  • Claim: the repository's Storybook hides the bug because it resolves StyleX in application order — verified (apps/storybook/.storybook/main.ts:210; the shared build config sets no resolution).
  • Claim: the layer resets the longhand margins and the shorthand loses to them — verified (useLayer.tsx:114-117, :159).
  • Claim: the entrance step is capped at the room to the trigger — verified (layerAnimations.stylex.ts:51; probe gap 0px on the base).
  • Claim: offset sets both placement-axis margins and keeps them through a flip — verified (useLayer.tsx:142-145, the slide rules; near-bottom probe flips with a 4px gap).
  • Claim: the offset option documents that layers sit flush by default — verified (useLayer.tsx:273-276).
  • Claim: the entrance browser spec already covers the menu crumb with and without room — verified (spec route list and test names).
  • Claim: other menus slide in from their trigger — verified in code (DropdownMenu and Selector pass an offset; ContextMenu is anchored at the pointer).
  • Claim: no API, interaction model or declared gap changes — verified (API surface comparison: 0 rows; the gap stays --spacing-1).
  • Claim: the new unit test fails on the old source and passes with the fix — verified (run on both).
  • Claim: interaction-spec pass counts under both resolutions — not rerun; consistent with the first-frame probe.
  • Claim: public text carries no internal context — verified.
  • File: .changeset/breadcrumb-menu-entrance-clearance.md — clear (pnpm check:changesets passes).
  • File: packages/core/src/Breadcrumbs/BreadcrumbItem.tsx — non-blocking comment-style suggestion.
  • File: packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx — clear.

Automated review (maintainer link)

Comment on lines +747 to +748
// The layer's own clearance: the layer runtime measures it as the
// entrance's room to the trigger and keeps it through a flip.

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.

Non-blocking (INV29 style: one topic per sentence). This sentence packs two topics and leaves out why the gap is an offset and not a margin. Suggested rewrite:

// A margin in xstyle loses to the layer's own margins. The layer keeps this
// gap through a flip. Its entrance slides across the gap.

@josephfarina
josephfarina marked this pull request as ready for review November 19, 2026 03:15
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12784 fix(Breadcrumbs): the menu crumb's menu slides in from the crumb in published builds
  Author: Joey Farina <[email protected]>
- #12327 chore(storybook): resolve StyleX merges the way the published CSS does
  Author: josephfarina <[email protected]>
- #12564 fix(Toast): a toast's card draws on the right side from the first paint
  Author: Joey <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12811.

@github-actions
github-actions Bot deleted the rl-56-4-crumb-menu-offset branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — d97f6e25 Deployed Nov 19, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant