Skip to content

Components: Re-land WPDS border token migration with Emotion-safe comments#79244

Merged
ciampo merged 3 commits into
trunkfrom
fix/wpds-token-comments-emotion
Jun 16, 2026
Merged

Components: Re-land WPDS border token migration with Emotion-safe comments#79244
ciampo merged 3 commits into
trunkfrom
fix/wpds-token-comments-emotion

Conversation

@ciampo

@ciampo ciampo commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What?

Re-lands #79003 (WPDS border token migration) plus a fix for the issue that broke storybook-check on trunk and caused the revert in #79243.

Part of #79001.

Why?

#79003's TODO comments referenced full WPDS token custom-property names inside Emotion .ts files. The esbuild token-fallback plugin claims any file whose text contains that prefix (comments included), which displaces the Emotion transform and makes styled-component selectors throw at runtime — failing 21 Storybook suites. no-ds-tokens missed it because it only checks string literals, not comments.

How?

Testing Instructions

  1. storybook-check should pass.
  2. With a dark admin color scheme, confirm the migrated borders adapt: disabled Button / FormToggle / RadioControl, and Panel / Modal / Toolbar / DropdownMenu dividers.

Follow-ups

  • Close the guardrail gap: #79245.

@github-actions github-actions Bot added the [Package] Components /packages/components label Jun 16, 2026
Base automatically changed from revert-79003-upd/79001-components-wpds-border-colors to trunk June 16, 2026 15:22
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Size Change: +171 B (0%)

Total Size: 8.58 MB

📦 View Changed
Filename Size Change
build/scripts/components/index.min.js 264 kB -43 B (-0.02%)
build/styles/components/style-rtl.css 18.1 kB +49 B (+0.27%)
build/styles/components/style-rtl.min.css 15.1 kB +56 B (+0.37%)
build/styles/components/style.css 18.2 kB +52 B (+0.29%)
build/styles/components/style.min.css 15.1 kB +57 B (+0.38%)

compressed-size-action

ciampo added 2 commits June 16, 2026 17:26
…ents

The esbuild design-token fallback plugin claims any JS/TS file whose source
text contains the `wpds` token prefix (a plain substring check, comments
included). Claiming the file replaces the Emotion transform, so styled
component selectors throw at runtime ("Component selectors can only be used
in conjunction with @emotion/babel-plugin"). #79003 introduced TODO comments
referencing the full token custom-property names in Emotion `.ts` files,
which broke the Storybook build on trunk.

Rephrase those comments (and pre-existing ones in dropdown-motion,
config-values, and use-modal-exit-animation) to name the WPDS tokens without
the CSS custom-property prefix, so the fallback plugin no longer claims these
files. The `no-ds-tokens` ESLint rule does not catch this because it only
inspects string literals and template elements, not comments.
@ciampo ciampo force-pushed the fix/wpds-token-comments-emotion branch from 62ece47 to ec51e94 Compare June 16, 2026 15:31
@ciampo ciampo marked this pull request as ready for review June 16, 2026 15:31
@ciampo ciampo requested review from a team and ajitbohra as code owners June 16, 2026 15:31
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ciampo ciampo self-assigned this Jun 16, 2026
@ciampo ciampo requested a review from manzoorwanijk June 16, 2026 15:33
@ciampo ciampo added the [Type] Code Quality Issues or PRs that relate to code quality label Jun 16, 2026

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍 Confirmed the changes match the previous pull request and that Storybook pages which crashed previously now load successfully.

Comment on lines +28 to +32
// Note: WPDS design tokens can't be referenced here directly. The build-time
// fallback injection is incompatible with Emotion, and even mentioning a token's
// full CSS custom property name in this file makes the esbuild fallback plugin
// claim it and break the Emotion transform. This file is consumed by Menu's
// Emotion styles.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should make it a point to mention in #79245 to remove or update these comments once the described behavior is corrected.

@ciampo ciampo merged commit 7519ba8 into trunk Jun 16, 2026
54 of 56 checks passed
@ciampo ciampo deleted the fix/wpds-token-comments-emotion branch June 16, 2026 21:15
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants