Skip to content

chore(storybook): resolve StyleX merges the way the published CSS does - #12327

Closed
josephfarina wants to merge 3 commits into
mainfrom
rl-17d-sb-resolution
Closed

josephfarina wants to merge 3 commits into
mainfrom
rl-17d-sb-resolution

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Storybook showed some components differently from what npm users get. Storybook compiled StyleX with styleResolution: 'application-order', and the published Core build uses StyleX's default, property-specificity. The two resolve some merges differently: a shorthand after its own longhand, or a component's longhand followed by a caller's xstyle shorthand. So a story could look right while the shipped component did not. A Markdown blockquote in a page template is one example.

Problem and solution fit

Storybook is where a component's look is reviewed and its visual baselines are taken, so it has to resolve styles the way the published CSS does. Both Storybook StyleX configs now leave styleResolution unset and get the same default as the published build.

Under property-specificity, StyleX rejects a few shorthands in stylex.create() (border, borderTop, borderBottom, background), as it does for Core itself. Six stories used them in their own demo styles. Each one now uses the longhands that say the same thing (borderWidth/borderStyle/borderColor, backgroundColor or backgroundImage). The Layer story's two borders pointed at an undefined variable, so the old shorthand painted no border; those two styles now drop the border, which keeps the old picture. Inline style={} props are unchanged. The Table virtualization release test build, which uses Storybook's resolution, matches it again.

Expected behavior and authority

A story renders what the published package renders.

Smallest restoration

  • apps/storybook/vite.config.ts and apps/storybook/.storybook/main.ts: drop styleResolution: 'application-order'.
  • The six stories: shorthand → longhands in their own stylex.create() styles, with the same result.
  • TableVirtualization.release.vite.mjs: drop the same option.

Evidence

  • Accepted visual baselines: every shot in .github/visual-baseline/manifest.json (516: 348 Neutral light/dark, 168 probe light/dark), captured from a Storybook built each way at the baseline viewport. 0 of 516 move.
  • Full story sweep: see the comment below.

Scope

Components: none (Storybook configuration and story demo styles)

  • 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

  • Storybook built both ways (storybook build); every story file compiles under the published resolution.
  • Chromium screenshots of every baselined shot from both builds, compared pixel for pixel.

@vercel

vercel Bot commented Nov 17, 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 17, 2026 1:10pm UTC

Request Review

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

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 1:21 PM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f0b2717

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.

Requesting changes. Matching Storybook's StyleX resolution to the published build is the right fix and Storybook builds cleanly with it, but two points need attention first.

  • The Layer story longhands do not say the same thing as the shorthands they replace: var(--color-border-default) is defined nowhere, so the old border shorthand painted no border, while the new borderWidth/borderStyle/borderColor paint a 1px black (currentColor) border on every Layer popover and dashed black borders on the Context Menu Press zones (apps/storybook/stories/Layer.stories.tsx:19-21 and :35-37); point borderColor at a defined token such as --color-border and mention the visible change, or drop those three longhands.
  • The description says "Full story sweep: see the comment below", but no such comment exists on the pull request; post the sweep or remove that line.

Non-blocking: packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs says it uses the same resolution as Storybook but still sets styleResolution: 'application-order', so consider dropping that line in this change too.

Claims and files checked

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

  • Claim: Storybook compiled StyleX with application-order while the published Core build uses StyleX's default, property-specificity. Verified: the removed lines in both Storybook configs; packages/core/babel.config.json sets no resolution; StyleX 0.19.1 defaults to property-specificity.
  • Claim: the two modes resolve a shorthand after its longhand, or a component longhand followed by a caller's xstyle shorthand, differently, and a Markdown blockquote shows it. Verified in code: Blockquote's marginInlineStart/marginInlineEnd longhands (Blockquote.tsx:43-44) against Markdown's caller marginInline shorthand (Markdown.tsx:391-393, :1748).
  • Claim: both Storybook StyleX configs now leave the resolution unset. Verified (.storybook/main.ts:207-218, vite.config.ts:23-34).
  • Claim: the default rejects border, borderTop, borderBottom and background in stylex.create(), as it does for Core. Verified: StyleX throws for them in this mode, and the Astryx wrapper sets validation to throw (packages/build/src/vite.ts:725).
  • Claim: six stories used them and now use longhands that say the same thing, with the same values. Six stories and the same values verified; "say the same thing" is false for two Layer styles (first finding).
  • Claim: inline style={} props are unchanged. Verified (Layer.stories.tsx:200, :327).
  • Claim: the baseline manifest has 516 shots (348 Neutral, 168 probe) and none move. Counts verified; the no-move result was not re-run across all 516, and the touched baselined stories captured here are pixel-identical.
  • Claim: a full story sweep is in a comment below. False (second finding).
  • Claim: Storybook builds both ways and every story compiles under the published resolution. Verified: Storybook builds at both the head and the base.
  • Claim: no component, public API, default or interaction changes. Verified: only apps/storybook changes.
  • File apps/storybook/.storybook/main.ts: clear.
  • File apps/storybook/vite.config.ts: clear.
  • File apps/storybook/stories/ChatAutoScroll.stories.tsx: clear.
  • File apps/storybook/stories/FormLayout.stories.tsx: clear.
  • File apps/storybook/stories/GridMasonry.stories.tsx: clear.
  • File apps/storybook/stories/Layer.stories.tsx: first finding.
  • File apps/storybook/stories/Layout.stories.tsx: clear.
  • File apps/storybook/stories/UseContainerReveal.stories.tsx: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Full story sweep

Every story in this Storybook (2,920), built twice from the same tree: once with application-order (before) and once with the published default (after). Each was captured in Chromium at 1024×768, Neutral theme, light, frozen clock, and compared pixel for pixel. Each story that differed was captured again in both builds to separate real moves from noise.

Moves that reproduce (same picture on a second capture in each build):

Story Pixels What moves
core-breadcrumbitem--public-states 5,799 The open crumb menu sits about 3px closer to its trigger.
core-breadcrumbs--menu-crumb-disabled-item 6,224 Same: the open crumb menu sits about 3px closer to its trigger.
core-avatargroup--wrapping-layout 1 Sub-pixel.
lab-navigationstack--declines-pops 4 Sub-pixel.
lab-pagecontrol--default 5 Sub-pixel.

Noise (changes between two captures of the same build): streaming and animated stories in charts-webgl, lab-chartstreamgl, lab-chartstreamperf, lab-codeeditorperf, core-markdown--streaming, core-markdowncitations--streaming-with-citations, core-typeahead--incremental-results-* and lab-commentpin--sizes.

Accepted baselines: 0 of 516 move. No moved story is in the baseline set.

The crumb menu position is what the published CSS renders today; Storybook now shows it too. Whether that offset is intended is tracked separately and is not changed here.

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

Requesting changes. The Layer border and Table fixture fixes from the last round are in, the story sweep is posted, and Storybook builds and renders as described, but one required check still fails.

  • Miss: the required lint check fails because apps/storybook/stories/GridMasonry.stories.tsx (lines 47 and 61) and the touched apps/storybook/stories/ChatAutoScroll.stories.tsx are not Prettier-formatted; run pnpm exec prettier --write on both files and push.
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: Storybook compiled StyleX with application-order while the published Core build uses the default, property-specificity. Verified: the removed lines in both Storybook configs; Core's Babel config sets no resolution; StyleX 0.19.1 defaults to property-specificity.
  • Claim: the two modes resolve a shorthand after its longhand, or a component longhand followed by a caller's xstyle shorthand, differently, as a Markdown blockquote shows. Verified in code (Blockquote longhands against Markdown's marginInline), and the Breadcrumb menu capture shows the same pattern.
  • Claim: both Storybook StyleX configs now leave the resolution unset. Verified (.storybook/main.ts:210-211, vite.config.ts:27-28).
  • Claim: the default rejects border, borderTop, borderBottom and background in stylex.create(), as for Core. Verified: StyleX throws for them in this mode, and the head Storybook builds with the longhands.
  • Claim: six stories used them and now use longhands that say the same thing. Verified: six files; the Layer captures are pixel-identical to the base and the other stories keep the same values.
  • Claim: the Layer story's two borders used an undefined variable, so dropping them keeps the old picture. Verified: nothing defines the variable, and both Layer captures are pixel-identical.
  • Claim: inline style={} props are unchanged. Verified: the diff touches none.
  • Claim: the Table virtualization release test build matches Storybook again. Verified (TableVirtualization.release.vite.mjs:14-17).
  • Claim: 516 accepted baseline shots (348 Neutral, 168 probe) and none move. Counts verified; consistent, since neither moved Breadcrumb story is baselined and the baselined menu-crumb story keeps its menu closed; the full comparison was not re-run.
  • Claim: a full story sweep is in a comment. Verified: the comment exists, and its two Breadcrumb moves reproduce (the menu's margin goes from 4px to 0px).
  • Claim: Storybook builds both ways and every story compiles. Verified: head and base builds pass.
  • Claim: no new public API, default or interaction model. Verified: only Storybook config, stories and a test-only build config change.
  • File apps/storybook/.storybook/main.ts: clear.
  • File apps/storybook/vite.config.ts: clear.
  • File apps/storybook/stories/ChatAutoScroll.stories.tsx: lint finding.
  • File apps/storybook/stories/FormLayout.stories.tsx: clear.
  • File apps/storybook/stories/GridMasonry.stories.tsx: lint finding.
  • File apps/storybook/stories/Layer.stories.tsx: clear.
  • File apps/storybook/stories/Layout.stories.tsx: clear.
  • File apps/storybook/stories/UseContainerReveal.stories.tsx: clear.
  • File packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs: clear.

Automated review (maintainer link)

@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 finished on this head yet. The formatting fix from the last round is in, every changed file is Prettier-clean, and the required lint check passes, so nothing in the change blocks. CI stopped at its capacity check ("CI is full") before test, build and docsite-test ran; re-run the CI jobs once there is room, and the merge guard waits for them to pass.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: Storybook compiled StyleX with application-order while the published Core build uses the default, property-specificity. Verified: the removed lines in both Storybook configs; Core's Babel config sets no resolution; StyleX 0.19.1 defaults to property-specificity.
  • Claim: the two modes resolve a shorthand after its own longhand, or a component longhand followed by a caller's xstyle shorthand, differently, as a Markdown blockquote shows. Verified in code (Blockquote's margin longhands against Markdown's marginInline); the Breadcrumb menu capture shows the same pattern.
  • Claim: both Storybook StyleX configs now leave the resolution unset. Verified (.storybook/main.ts:210-211, vite.config.ts:27-28).
  • Claim: under the default, StyleX rejects border, borderTop, borderBottom and background in stylex.create(), as for Core. Verified: the StyleX plugin throws for each of them, and the head Storybook builds with the longhands.
  • Claim: six stories used them and now use longhands that say the same thing. Verified: six files with the same values; the Layer and Masonry captures are pixel-identical to the base.
  • Claim: the Layer story's two borders used an undefined variable, so dropping them keeps the old picture. Verified: nothing defines the variable, and the Layer capture is pixel-identical.
  • Claim: inline style={} props are unchanged. Verified: the diff touches none.
  • Claim: the Table virtualization release test build matches Storybook again. Verified (TableVirtualization.release.vite.mjs:14-17).
  • Claim: 516 accepted baseline shots (348 Neutral, 168 probe) and none move. Counts verified; consistent, since no story that moves is baselined; the full comparison was not re-run.
  • Claim: a full story sweep is in a comment. Verified: the comment exists, and its two Breadcrumb moves reproduce (the menu's top margin goes from 4px to 0px).
  • Claim: Storybook builds both ways and every story file compiles under the published resolution. Verified: the head static build passes; the base build passed in the last round on the same base.
  • Claim: no new public API, visual representation, default or interaction model. Verified: only Storybook config, stories and a test-only build config change.
  • File apps/storybook/.storybook/main.ts: clear.
  • File apps/storybook/vite.config.ts: clear.
  • File apps/storybook/stories/ChatAutoScroll.stories.tsx: clear (formatting fixed).
  • File apps/storybook/stories/FormLayout.stories.tsx: clear.
  • File apps/storybook/stories/GridMasonry.stories.tsx: clear (formatting fixed).
  • File apps/storybook/stories/Layer.stories.tsx: clear.
  • File apps/storybook/stories/Layout.stories.tsx: clear.
  • File apps/storybook/stories/UseContainerReveal.stories.tsx: clear.
  • File packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs: clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 18, 2026
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-17d-sb-resolution branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — f0b27170 Deployed Nov 17, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant