Skip to content

Global Styles UI: Use design tokens for the variation card frames - #87913

Draft
jeryj wants to merge 2 commits into
trunkfrom
update/global-styles-ui-variation-tokens
Draft

jeryj wants to merge 2 commits into
trunkfrom
update/global-styles-ui-variation-tokens

Conversation

@jeryj

@jeryj jeryj commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What?

See #87680. Follows #87426.

The variation cards in @wordpress/global-styles-ui (the color and typography pickers, and Browse styles) now use design tokens, so they work in dark themes.

Why?

The cards hardcoded their frame colors. In a dark theme, the selected ring, border and hover were invisible, and the typography card was white on white.

How?

The same tokens as the pattern previews in #87426:

  • Border and hover: --wpds-color-stroke-interactive-neutral and its -active state.
  • Selected ring: --wpds-color-foreground-interactive-neutral.
  • Focus ring: --wpds-color-stroke-focus. The card no longer draws a second ring.
  • A preview without the site's colors uses the surface and content tokens that Card uses.

This also fixes hovering a focused card hiding its focus ring.

Related: #87815, #76850.

Testing Instructions

  1. With Twenty Twenty-Five, open Appearance → Editor → Styles.
  2. Check the cards in Colors → Palette, Typography and Browse styles. The only change is a darker border, as in Block Editor: Use theme colors in the inserter, sidebars, header, and footer #87426.
  3. Run npm run test:unit -- --project=browser packages/global-styles-ui/src/variations/test/variation.browser.test.tsx.

Testing Instructions for Keyboard

Tab to a card. One focus ring shows, and it stays when hovered.

Screenshots or screencast

To be added.

Use of AI Tools

Claude Code (Claude Opus 5.5) wrote the code, the tests and this description.

🤖 Generated with Claude Code

The color, typography and style variation cards hardcoded their frame
colors, so under a dark theme the selected ring, border and hover outline
were invisible, the focus ring used wp-admin's accent color, and the
typography card was white on white.

Follow the pattern preview frames from #87426: the border and hover use
the neutral interactive stroke tokens, the selected ring the neutral
interactive foreground, and the focus ring the focus stroke, both at the
focus width, with a surface band between ring and preview. The selected
and focus rules come after hover, so hovering no longer hides them. The
card element no longer draws its own focus outline.

Without the site's own colors, the preview uses the surface and content
tokens `Card` uses, so the typography card and the Browse styles label
stay readable in any theme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeryj jeryj added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

📦 Bundle size

Size Change: +227 B (0%)

Total Size: 8.86 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 579 kB +35 B (+0.01%)
build/styles/edit-site/style-rtl.css 21.8 kB +28 B (+0.13%)
build/styles/edit-site/style-rtl.min.css 17.8 kB +30 B (+0.17%)
build/styles/edit-site/style.css 21.8 kB +28 B (+0.13%)
build/styles/edit-site/style.min.css 17.8 kB +30 B (+0.17%)
build/styles/editor/style-rtl.css 32.8 kB +19 B (+0.06%)
build/styles/editor/style-rtl.min.css 28.5 kB +17 B (+0.06%)
build/styles/editor/style.css 32.9 kB +21 B (+0.06%)
build/styles/editor/style.min.css 28.5 kB +19 B (+0.07%)

e857ed5 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f32c8bc trunk % Change
timeToFirstByte 44.25 ms +16.5% -1.69% 46.85 ms +8.22% -5.98% -5.55%
largestContentfulPaint 74 ms +8.11% -8.11% 72 ms +5.56% -2.78% 2.78%
lcpMinusTtfb 27.2 ms +17.1% -9.56% 24.6 ms +19.72% -9.35% 10.57%
wpBeforeTemplate 23.45 ms +20.17% -1.75% 23.94 ms +18.67% -3.59% -2.05%
wpTemplate 17.67 ms +6.68% -2.94% 17.72 ms +5.87% -1.41% -0.28%
wpTotal 40.92 ms +17.2% -1.66% 43.49 ms +8.44% -6.28% -5.91%
wpMemoryUsage 7.76 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f32c8bc trunk % Change
timeToFirstByte 36.1 ms +6.51% -2.77% 37.35 ms +3.88% -5.09% -3.35%
largestContentfulPaint 64 ms +3.13% -0% 66 ms +3.03% -3.03% -3.03%
lcpMinusTtfb 28.9 ms +1.56% -3.46% 29 ms +2.24% -3.97% -0.34%
wpBeforeTemplate 20.09 ms +3.43% -1.29% 20.12 ms +7.36% -0.99% -0.15%
wpTemplate 12.85 ms +4.05% -2.72% 12.64 ms +8.94% -1.82% 1.66%
wpTotal 33.11 ms +7.01% -2.02% 33.85 ms +6.2% -4.37% -2.19%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f32c8bc trunk % Change
mediaProcessingJpeg 324.37 ms +0.91% -0.67% 325.66 ms +3.14% -1.17% -0.4%
mediaProcessingAvif 4853.5 ms +0.43% -0.26% 4845.67 ms +0.63% -0.15% 0.16%
mediaProcessingJpegToAvif 3371.03 ms +0.58% -0.03% 3382.64 ms +0.45% -0.17% -0.34%

media-upload

Metric f32c8bc trunk % Change
jpegUploadProcessing 1464.67 ms +1.3% -1.75% 1455.27 ms +1.46% -0.41% 0.65%
pngUploadProcessing 241.1 ms +3.21% -0.35% 239.01 ms +2.37% -1.55% 0.87%
largeJpegUploadProcessing 1442.05 ms +0.44% -0.63% 1440.94 ms +1.24% -0.43% 0.08%
multipleImageUploadProcessing 1513.21 ms +0.86% -1.15% 1540.62 ms +0.55% -0.99% -1.78%

post-editor

Metric f32c8bc trunk % Change
serverResponse 337.78 ms +1.89% -6.85% 327.46 ms +3.82% -4.41% 3.15%
firstPaint 332.65 ms +6.52% -6.87% 363.18 ms +3.19% -11.2% -8.41%
domContentLoaded 659.9 ms +3.46% -0.48% 665.3 ms +1.54% -1.23% -0.81%
loaded 660.91 ms +3.47% -0.48% 666.32 ms +1.52% -1.25% -0.81%
firstContentfulPaint 375.55 ms +2.53% -3.4% 372.61 ms +4.48% -1.73% 0.79%
firstBlock 1708.46 ms +1.04% -0.56% 1726.22 ms +0.61% -0.72% -1.03%
type 15.52 ms +6.38% -12.63% 15.88 ms +1.76% -13.73% -2.27%
typeWithoutInspector 14.83 ms +13.49% -6.14% 14.97 ms +3.94% -11.09% -0.94%
typeWithTopToolbar 20.29 ms +4.88% -2.37% 19.92 ms +3.92% -7.43% 1.86%
typeContainer 7.3 ms +8.77% -3.7% 7.36 ms +11.14% -4.21% -0.82%
focus 89.1 ms +5.89% -4.96% 84.41 ms +5.98% -2.12% 5.56%
firstFocus 212.25 ms +0% -0% 208.97 ms +0% -0% 1.57%
selectAll 286.37 ms +1.07% -0.88% 269.58 ms +0.89% -0.21% 6.23%
undo 23.67 ms +11.66% -5.2% 24.13 ms +1.49% -3.07% -1.91%
listViewOpen 30.57 ms +5.53% -4.09% 31.1 ms +4.57% -5.79% -1.7%
inserterOpen 31.58 ms +13.46% -5.67% 32.86 ms +4.35% -11.26% -3.9%
inserterHover 9.89 ms +13.55% -10.11% 9.74 ms +10.78% -3.9% 1.54%
inserterSearch 7.46 ms +8.45% -3.35% 7.25 ms +9.66% -8% 2.9%
loadPatterns 536.75 ms +3.51% -1.7% 529.73 ms +6.79% -2.38% 1.33%
wpTotal 329.63 ms +1.68% -7.08% 318.83 ms +4.05% -4.44% 3.39%
wpMemoryUsage 14.80 MB +0% -0% 14.76 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric f32c8bc trunk % Change
serverResponse 328.81 ms +1.41% -5.24% 323.32 ms +1.17% -9.5% 1.7%
firstPaint 374.82 ms +4.42% -10.7% 382.5 ms +10.1% -10.23% -2.01%
domContentLoaded 695.63 ms +1.03% -3.32% 707.59 ms +1.95% -2.7% -1.69%
loaded 696.69 ms +1.03% -3.31% 708.68 ms +1.95% -2.69% -1.69%
firstContentfulPaint 391.13 ms +2.12% -5.21% 394.41 ms +6.78% -4.39% -0.83%
firstBlock 2115.54 ms +5.38% -1.22% 2129.72 ms +1.2% -2.02% -0.67%
type 17.83 ms +1.91% -16.66% 16 ms +11.06% -8.19% 11.44%
navigate 97.12 ms +3.84% -6.1% 89.71 ms +5.61% -4.14% 8.26%
loadPatterns 1329.12 ms +12.68% -14.25% 1129.71 ms +8.77% -10.43% 17.65%
loadPages 954.92 ms +6.62% -1.26% 976.12 ms +6.48% -1.83% -2.17%
wpTotal 320.38 ms +1.5% -5.38% 314.89 ms +1.21% -9.73% 1.74%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

e857ed5 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Overlay menu interactions in Safari (@WebKit) in /test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('region', { name: 'Editor top bar' }).getByRole('button', { name: 'Save', exact: true })
    - locator resolved to <button type="button" aria-disabled="true" class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact">Save</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
      - waiting 100ms
    17 × waiting for element to be visible, enabled and stable
       - element is not enabled
     - retrying click action
       - waiting 500ms

    at Editor.saveSiteEditorEntities (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/site-editor.ts:39:22)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js:40:4

e857ed5 Run

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant