Skip to content

Components: Replace the accent-darker SCSS variables with design tokens - #86797

Merged
mirka merged 7 commits into
trunkfrom
components-accent-darker-tokens
Nov 23, 2026
Merged

mirka merged 7 commits into
trunkfrom
components-accent-darker-tokens

Conversation

@mirka

@mirka mirka commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

What?

Replaces the remaining usages of the $components-color-accent-darker-10 SCSS variable in @wordpress/components with design tokens, and removes the $components-color-accent-darker-10 and $components-color-accent-darker-20 SCSS variables. Follow-up to #86683.

Why?

@wordpress/components is moving off its --wp-components-color-* variables and onto the @wordpress/theme design tokens. These were the last usages of the accent-darker SCSS variables, and darker-20 had no usages left.

How?

Neither usage represents a hover or pressed state, so both use the regular brand tokens instead of the darker -active ones. With the opacity dropped, the MenuItem disabled tertiary override would compute the same color and background as Button's own disabled tertiary style, so the override is removed instead of migrated.

Testing Instructions

  1. Open the ToolsPanel "Default" story in Storybook.
  2. Open the panel options menu without entering any values. "Reset all" is disabled and shows as gray text, the same color as other disabled tertiary buttons.
  3. Enter a value in "Height" and open the menu again. The "Reset" label next to "Height" uses the brand color, slightly lighter than before. "Reset all" is enabled and unchanged.
  4. Repeat with the "WordPress" Global CSS option in the toolbar. The results are the same.
  5. Repeat with forced colors mode active. The disabled "Reset all" uses the system disabled color, the same as the other disabled items, and the enabled "Reset all" uses the regular text color.

Screenshots or screencast

The "Reset" label changes from #2145e6 to the brand foreground color, #3858e9 by default.

Before After
ToolsPanel options menu with a darker blue Reset label next to Height ToolsPanel options menu with a brand blue Reset label next to Height

The disabled "Reset all" item changes from a faded blue to the gray disabled color.

Before After
ToolsPanel options menu with a faded blue, disabled Reset all item ToolsPanel options menu with a gray, disabled Reset all item

In forced colors mode, the disabled "Reset all" item was previously faded by the opacity. It now uses the system disabled color, like the other disabled items in the menu. This applies to every MenuItem with aria-disabled, which browsers do not give the disabled color on their own.

Use the brand foreground token for the ToolsPanel reset label, and let
Button's disabled tertiary style apply to MenuItem instead of overriding
it with the accent-darker color and reduced opacity. Remove the unused
`$components-color-accent-darker-10` and `-20` SCSS variables.
@mirka mirka added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Nov 13, 2026
@mirka mirka self-assigned this Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

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: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: -110 B (0%)

Total Size: 8.69 MB

📦 View Changed
Filename Size Change
build/scripts/components/index.min.js 346 kB -32 B (-0.01%)
build/styles/components/style-rtl.css 18.3 kB -23 B (-0.13%)
build/styles/components/style-rtl.min.css 15.4 kB -16 B (-0.1%)
build/styles/components/style.css 18.3 kB -22 B (-0.12%)
build/styles/components/style.min.css 15.4 kB -17 B (-0.11%)

87733cc Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric fda1903 trunk % Change
timeToFirstByte 55.1 ms +17.15% -0.73% 56.95 ms +7.99% -2.72% -3.25%
largestContentfulPaint 92 ms +4.35% -8.7% 92 ms +4.35% -8.7% 0%
lcpMinusTtfb 29.3 ms +26.96% -1.88% 31.65 ms +20.22% -9.64% -7.42%
wpBeforeTemplate 29.44 ms +17.8% -2% 29.39 ms +12.59% -1.02% 0.17%
wpTemplate 22.35 ms +5.46% -3.67% 22.73 ms +4.71% -2.6% -1.67%
wpTotal 51.22 ms +17.18% -1.09% 53.12 ms +8.21% -3.22% -3.58%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric fda1903 trunk % Change
timeToFirstByte 46.1 ms +6.72% -1.41% 47.6 ms +5.04% -3.57% -3.15%
largestContentfulPaint 80 ms +5% -0% 82 ms +2.44% -2.44% -2.44%
lcpMinusTtfb 34.7 ms +2.45% -1.87% 34.75 ms +3.45% -3.45% -0.14%
wpBeforeTemplate 26.51 ms +7.36% -0.98% 26.85 ms +2.27% -1.45% -1.27%
wpTemplate 16.59 ms +3.25% -3.44% 17.15 ms +3.44% -4.37% -3.27%
wpTotal 42.86 ms +7.3% -1.35% 44.27 ms +5.11% -3.46% -3.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 fda1903 trunk % Change
mediaProcessingJpeg 402.65 ms +0.53% -0.42% 404.61 ms +0.81% -0.28% -0.48%
mediaProcessingAvif 6139.89 ms +0.44% -0.23% 6174.82 ms +0.27% -0.15% -0.57%
mediaProcessingJpegToAvif 4255.67 ms +0.21% -0.41% 4282.59 ms +0.26% -0.36% -0.63%

media-upload

Metric fda1903 trunk % Change
jpegUploadProcessing 1990.64 ms +1.35% -23.07% 1986.67 ms +0.87% -0.4% 0.2%
pngUploadProcessing 286.44 ms +4.12% -6.52% 276.12 ms +3.77% -3.06% 3.74%
largeJpegUploadProcessing 1508.66 ms +28.24% -0.93% 1742.05 ms +13.73% -13.48% -13.4%
multipleImageUploadProcessing 2106.04 ms +2.17% -0.12% 2153.88 ms +0.5% -3.86% -2.22%

post-editor

Metric fda1903 trunk % Change
serverResponse 488.98 ms +2.98% -6.65% 488.17 ms +2.91% -4.43% 0.17%
firstPaint 416.65 ms +8.47% -5.47% 415.29 ms +3.89% -4.51% 0.33%
domContentLoaded 834.2 ms +3.93% -1.6% 812.02 ms +3.68% -0.31% 2.73%
loaded 835.28 ms +3.9% -1.6% 813.18 ms +3.65% -0.31% 2.72%
firstContentfulPaint 478.19 ms +4.94% -2.16% 456.9 ms +5.39% -0.77% 4.66%
firstBlock 2221.82 ms +9.16% -1.5% 2229.88 ms +1.5% -1.39% -0.36%
type 17.01 ms +9.88% -6.35% 17.79 ms +4.89% -14% -4.38%
typeWithoutInspector 17.17 ms +6.46% -6.99% 17.65 ms +4.48% -14.22% -2.72%
typeWithTopToolbar 22.13 ms +5.2% -8.9% 23.16 ms +1.9% -13.56% -4.45%
typeContainer 7.72 ms +10.49% -7.25% 7.6 ms +8.68% -6.05% 1.58%
focus 116.51 ms +2.11% -5.52% 107.74 ms +3.29% -2.13% 8.14%
firstFocus 264.06 ms +0% -0% 268.88 ms +0% -0% -1.79%
selectAll 398.47 ms +6.08% -1.23% 411.31 ms +1.8% -4.09% -3.12%
undo 29.87 ms +4.72% -5.19% 29.19 ms +4.73% -6.89% 2.33%
listViewOpen 64.48 ms +7.03% -4.17% 64.3 ms +16.17% -18.43% 0.28%
inserterOpen 42.78 ms +8.93% -12.04% 38.88 ms +13.04% -5.32% 10.03%
inserterHover 11.39 ms +9.92% -6.85% 11.42 ms +7.27% -7.88% -0.26%
inserterSearch 7.89 ms +2.03% -5.58% 8.09 ms +6.67% -5.81% -2.47%
loadPatterns 647.71 ms +7.87% -4.14% 616.69 ms +2.43% -3.57% 5.03%
wpTotal 478.39 ms +3.23% -6.58% 478.47 ms +2.98% -4.65% -0.02%
wpMemoryUsage 14.81 MB +0% -0% 14.78 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric fda1903 trunk % Change
serverResponse 242.37 ms +1.22% -1.88% 240.22 ms +0.64% -1.14% 0.9%
firstPaint 264.85 ms +10.3% -4.31% 271.66 ms +7.13% -7.5% -2.51%
domContentLoaded 519.98 ms +2.8% -3.13% 498.05 ms +1.14% -0.2% 4.4%
loaded 520.68 ms +2.77% -3.14% 498.7 ms +1.17% -0.21% 4.41%
firstContentfulPaint 306.13 ms +7.54% -4.57% 283.82 ms +2.79% -0.88% 7.86%
firstBlock 1579.65 ms +3.26% -1% 1539.96 ms +0.22% -0.64% 2.58%
type 11.36 ms +4.23% -8.89% 11 ms +7.27% -5.73% 3.27%
navigate 68.4 ms +6.26% -3.58% 68.33 ms +7.89% -7.33% 0.1%
loadPatterns 845.51 ms +3.39% -11.72% 855.99 ms +7.72% -5.65% -1.22%
loadPages 935.44 ms +3.35% -4.71% 932.55 ms +4.22% -1.69% 0.31%
wpTotal 236.11 ms +1.34% -1.85% 234.12 ms +0.59% -1.15% 0.85%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

87733cc 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.

does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByRole('listbox', { name: 'Search results' })
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" getByRole('listbox', { name: 'Search results' }) with timeout 5000ms
  - waiting for getByRole('listbox', { name: 'Search results' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:423:33)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:3
should select synced pattern in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]') with timeout 5000ms
  - waiting for locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
    13 × locator resolved to <div tabindex="0" role="document" draggable="true" data-title="Pattern" data-type="core/block" data-is-drop-zone="true" aria-label="Block: Pattern" id="block-7ea322c7-bead-4837-bff2-a45d190a2eb1" data-block="7ea322c7-bead-4837-bff2-a45d190a2eb1" class="block-editor-block-list__block wp-block is-selected is-reusable block-library-block__reusable-block-container wp-block-block block-editor-block-list__layout">…</div>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:1464:5

87733cc Run

Dropping the disabled tertiary opacity removed the only cue that the
aria-disabled "Reset all" item was disabled in forced colors mode.
@mirka
mirka marked this pull request as ready for review November 13, 2026 11:58
@mirka
mirka requested a review from a team as a code owner November 13, 2026 11:58
…lors

Button fills pressed disabled items with GrayText and sets a Canvas
foreground. The aria-disabled GrayText color loaded after it and hid the
label and icon.
@github-actions
github-actions Bot requested review from aduth and ciampo November 17, 2026 11:35
@mirka
mirka requested a review from a team November 17, 2026 11:42
@ciampo

ciampo commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Always like more cleanup and consistency work!

In Chrome's dark forced-colors mode, a disabled item's label uses GrayText while its info text still renders in the enabled color. Maybe we could make .components-menu-item__info inherit the button color inside this rule?

Chromium forced colors gave the info text the enabled text color while
the label used GrayText.
@mirka

mirka commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Fixed:

Forced colors Before After
Dark Disabled menu item in dark forced colors, with the label in the disabled color and the description in white Disabled menu item in dark forced colors, with the label and the description both in the disabled color
Light Disabled menu item in light forced colors, with the label in the disabled color and the description in black Disabled menu item in light forced colors, with the label and the description both in the disabled color

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

LGTM 🚀

One extra nit: label and description now match for an unpressed disabled item. Could we also let the description inherit when the item is pressed, keeping the :not(.is-pressed) guard just on color: GrayText?

@mirka

mirka commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

One extra nit: label and description now match for an unpressed disabled item. Could we also let the description inherit when the item is pressed, keeping the :not(.is-pressed) guard just on color: GrayText?

I had split this out to #87153 since it was an existing/separate issue discovered in testing. I will continue there 👍

@mirka
mirka merged commit 66e096a into trunk Nov 23, 2026
84 of 85 checks passed
@mirka
mirka deleted the components-accent-darker-tokens branch November 23, 2026 12:32
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 23, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
…ns (WordPress#86797)

* Components: Replace the accent-darker SCSS variables with design tokens

Use the brand foreground token for the ToolsPanel reset label, and let
Button's disabled tertiary style apply to MenuItem instead of overriding
it with the accent-darker color and reduced opacity. Remove the unused
`$components-color-accent-darker-10` and `-20` SCSS variables.

* Add the changelog link

* MenuItem: Show aria-disabled items as disabled in forced colors mode

Dropping the disabled tertiary opacity removed the only cue that the
aria-disabled "Reset all" item was disabled in forced colors mode.

* MenuItem: Keep the pressed foreground for disabled items in forced colors

Button fills pressed disabled items with GrayText and sets a Canvas
foreground. The aria-disabled GrayText color loaded after it and hid the
label and icon.

* MenuItem: Show disabled info text in the disabled color in forced colors

Chromium forced colors gave the info text the enabled text color while
the label used GrayText.

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
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