Repository navigation
fix(Breadcrumbs): the menu crumb's menu slides in from the crumb in published builds - #12784
josephfarina wants to merge 1 commit into
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
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.tsxlines 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:
offsetsets 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:changesetspasses). - File:
packages/core/src/Breadcrumbs/BreadcrumbItem.tsx— non-blocking comment-style suggestion. - File:
packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx— clear.
| // The layer's own clearance: the layer runtime measures it as the | ||
| // entrance's room to the trigger and keeps it through a flip. |
There was a problem hiding this comment.
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.- #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]>
|
Landed in #12811. |
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
marginBlockin the surface's layer style. The layer's own styles set the longhands:marginBlockStart: 0and a far-edge gutter onmarginBlockEnd. Under property-specificity resolution a longhand beats a shorthand whatever the merge order, so the gap became 0.The fix passes the gap as the layer's
offset, as DropdownMenu does.offsetsets 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
LayerEntranceSide.interaction.browser.spec.tsalready 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
styleResolutionoverride),LayerEntranceSide.interaction.browser.spec.ts: both Breadcrumbs cases fail ("the first frame moves the layer toward its trigger (translate 0, 0)"), every repeat.Scope
Components: BreadcrumbItem
Testing
CI=1 pnpm exec vitest run packages/corepnpm test:interaction --project=chromium packages/core/src/Layer/__tests__/LayerEntranceSide.interaction.browser.spec.tsagainst Storybook built with each resolutionpnpm check:changesetspreflight: pass d97f6e2 (manual)