Skip to content

Button: Use WPDS colors for disabled states - #86681

Merged
ciampo merged 4 commits into
trunkfrom
codex/button-disabled-tokens
Nov 12, 2026
Merged

ciampo merged 4 commits into
trunkfrom
codex/button-disabled-tokens

Conversation

@ciampo

@ciampo ciampo commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

First value-only slice of #85073, following the discussion about smaller changes.

What?

Use WPDS tokens for ordinary disabled Button colors, including native and focusable disabled controls.

Why?

Disabled primary buttons currently retain a saturated brand or destructive fill, and other disabled labels use a fixed gray in dark themes.

How?

Replace color values in the existing declarations. The compiled selectors, specificity, layout, enabled colors, and busy stripes stay unchanged. Pressed-specific overrides remain for the later Button/Toolbar/header migration.

Testing Instructions

  1. Run npm run storybook:e2e:dev and open Components → Button → Variant States.
  2. Compare the disabled, focusable disabled, and destructive disabled rows in light, dark, and custom themes. Primary disabled buttons should use the theme's neutral disabled fill; other disabled labels should use its disabled foreground.
  3. Hover disabled controls. Their disabled colors should stay in place. Busy primary buttons should retain their stripes and label color.

Testing Instructions for Keyboard

Tab to a focusable disabled button. Its focus ring should remain visible, and Enter or Space should not activate it.

Screenshots or screencast

Refreshed after rebasing onto trunk f12625757ec. After: fb5d6885e56. Both sides use the same Button source with the production components stylesheet compiled from the indicated revision. Variant States uses a 1060 × 760 viewport with reduced motion. The dark detail shows the native-disabled row from the matrix below.

Theme Before After
Light Button before, Light Button after, Light
Dark, native disabled Button before, Dark, native disabled Button after, Dark, native disabled
Custom orange Button before, Custom orange Button after, Custom orange

Use of AI Tools

Implemented with Codex, including independent local agent review and browser verification.

Complete color-state comparisons

Each matrix renders all five variants with every combination of pressed, destructive, busy, and enabled/native-disabled/focusable-disabled props. The local fixture uses Button and its production package stylesheet. Hover, focus, and active matrices use browser-forced CSS states to expose the full cascade. A real Space activation was also checked. Disabled controls forced active are CSS inspection cases, not claims that they can be activated. The one-off fixture and checks are not part of this PR.

Before: trunk f12625757ec. After: fb5d6885e56. Matching 1180 × 1450 viewport and reduced motion.

Theme / CSS state Before After
light, rest Before: light, rest After: light, rest
light, hover Before: light, hover After: light, hover
light, focus Before: light, focus After: light, focus
light, active Before: light, active After: light, active
dark, rest Before: dark, rest After: dark, rest
dark, hover Before: dark, hover After: dark, hover
dark, focus Before: dark, focus After: dark, focus
dark, active Before: dark, active After: dark, active
orange, rest Before: orange, rest After: orange, rest
orange, hover Before: orange, hover After: orange, hover
orange, focus Before: orange, focus After: orange, focus
orange, active Before: orange, active After: orange, active
Real editor: header and block toolbar overrides

The isolated WordPress editor runs this checkout at fb5d6885e56. Both captures use the same paragraph, active Bold control, and open Block Inserter at 1440 × 1000 with reduced motion. Before loads the production components stylesheet compiled from trunk f12625757ec; after loads the current checkout's production stylesheet. The surrounding editor code is the same in both captures.

Before After
Editor before Editor after

@github-actions

github-actions Bot commented Nov 11, 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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jasmussen <joen@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: +28 B (0%)

Total Size: 8.64 MB

📦 View Changed
Filename Size Change
build/styles/components/style-rtl.css 17.8 kB +9 B (+0.05%)
build/styles/components/style-rtl.min.css 14.9 kB +5 B (+0.03%)
build/styles/components/style.css 17.9 kB +10 B (+0.06%)
build/styles/components/style.min.css 14.9 kB +4 B (+0.03%)

7bcfd16 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f57144f trunk % Change
timeToFirstByte 57.95 ms +4.14% -5.09% 56.45 ms +7% -3.9% 2.66%
largestContentfulPaint 92 ms +4.35% -4.35% 90 ms +8.89% -6.67% 2.22%
lcpMinusTtfb 33.2 ms +19.58% -9.94% 32.7 ms +14.07% -14.98% 1.53%
wpBeforeTemplate 29.87 ms +6.16% -1.57% 29.48 ms +13.47% -1.73% 1.32%
wpTemplate 22.53 ms +7.32% -3.68% 22.07 ms +5.39% -3.76% 2.08%
wpTotal 53.88 ms +4.16% -4.94% 52.57 ms +7.3% -3.99% 2.49%
wpMemoryUsage 7.72 MB +0% -0% 7.69 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f57144f trunk % Change
timeToFirstByte 49.2 ms +6.4% -5.49% 46.6 ms +8.91% -1.61% 5.58%
largestContentfulPaint 86 ms +2.33% -2.33% 80 ms +5% -0% 7.5%
lcpMinusTtfb 36.5 ms +2.47% -4.38% 34.15 ms +2.93% -1.02% 6.88%
wpBeforeTemplate 27.01 ms +11.14% -0.7% 27.01 ms +6.33% -3.26% 0%
wpTemplate 16.97 ms +7.48% -3.65% 16.64 ms +3.12% -3.73% 1.98%
wpTotal 44.49 ms +9.01% -2.74% 43.42 ms +9.72% -1.54% 2.46%
wpMemoryUsage 6.41 MB +0% -0% 6.38 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f57144f trunk % Change
mediaProcessingJpeg 405.81 ms +1.52% -1.47% 401.25 ms +0.85% -1.61% 1.14%
mediaProcessingAvif 6186.11 ms +0.45% -0.25% 6169.63 ms +0.2% -0.24% 0.27%
mediaProcessingJpegToAvif 4266.42 ms +0.36% -0.21% 4256.17 ms +0.36% -0.45% 0.24%

media-upload

Metric f57144f trunk % Change
jpegUploadProcessing 1994.31 ms +1.62% -22.96% 1980.05 ms +0.96% -20.9% 0.72%
pngUploadProcessing 282.06 ms +1.29% -1.28% 283.58 ms +1.88% -4.81% -0.54%
largeJpegUploadProcessing 1996.54 ms +0.87% -2.08% 1990.74 ms +0.53% -1.29% 0.29%
multipleImageUploadProcessing 2078.09 ms +0.95% -0.47% 2110.39 ms +1.82% -1.14% -1.53%

post-editor

Metric f57144f trunk % Change
serverResponse 482.71 ms +3.97% -6.58% 494.28 ms +1.94% -6.51% -2.34%
firstPaint 439.56 ms +11% -5.12% 420.12 ms +2.16% -5.18% 4.63%
domContentLoaded 840.85 ms +1.33% -0.71% 842.45 ms +2.27% -1.82% -0.19%
loaded 842.14 ms +1.32% -0.7% 843.81 ms +2.25% -1.84% -0.2%
firstContentfulPaint 471.92 ms +3.89% -1.37% 472.7 ms +1.78% -3.17% -0.17%
firstBlock 2264.04 ms +0.76% -0.92% 2253.55 ms +0.51% -1.77% 0.47%
type 21.59 ms +28.99% -13.85% 17.29 ms +9.02% -6.82% 24.87%
typeWithoutInspector 18.92 ms +3.65% -12.05% 18.68 ms +3.32% -8.99% 1.28%
typeWithTopToolbar 23.87 ms +4.61% -6.28% 23.68 ms +18.24% -4.18% 0.8%
typeContainer 9.02 ms +8.43% -8.31% 8.7 ms +11.38% -17.24% 3.68%
focus 125.64 ms +3.54% -7.88% 123.98 ms +4.36% -6.16% 1.34%
firstFocus 283.71 ms +0% -0% 272.03 ms +0% -0% 4.29%
selectAll 418.85 ms +1.77% -2.95% 438.48 ms +0.68% -1.71% -4.48%
undo 30.91 ms +2.36% -6.66% 30.81 ms +11.78% -8.11% 0.32%
listViewOpen 86.01 ms +7.53% -11.42% 81.51 ms +14.43% -4.92% 5.52%
inserterOpen 43.29 ms +11.46% -9.73% 45.33 ms +22.7% -6.6% -4.5%
inserterHover 12.29 ms +5.86% -15.3% 11.98 ms +10.68% -10.43% 2.59%
inserterSearch 8.53 ms +3.4% -10.55% 8.15 ms +12.39% -4.42% 4.66%
loadPatterns 713.7 ms +2.18% -4.02% 691.03 ms +4.17% -4.66% 3.28%
wpTotal 473.04 ms +4.05% -6.75% 484.44 ms +1.7% -6.63% -2.35%
wpMemoryUsage 14.78 MB +0% -0% 14.74 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric f57144f trunk % Change
serverResponse 313.89 ms +1.12% -0.85% 317.8 ms +0.76% -9.17% -1.23%
firstPaint 369.76 ms +2.48% -15.69% 351.28 ms +4.41% -9.05% 5.26%
domContentLoaded 657.45 ms +2.25% -2.34% 650.82 ms +1.91% -1.96% 1.02%
loaded 658.17 ms +2.25% -2.33% 651.66 ms +1.91% -1.97% 1%
firstContentfulPaint 377.38 ms +6.21% -3.42% 370.26 ms +2.21% -2.7% 1.92%
firstBlock 1988.16 ms +1.32% -0.98% 1992.99 ms +0.26% -1.25% -0.24%
type 14.38 ms +8.21% -5.22% 14.85 ms +4.58% -7.14% -3.16%
navigate 90.82 ms +8.95% -1.12% 93.93 ms +4.36% -8.63% -3.31%
loadPatterns 1089.25 ms +9.59% -7.74% 1011.58 ms +11.24% -14.16% 7.68%
loadPages 1008.97 ms +0.72% -6.34% 956.06 ms +6.74% -4.98% 5.53%
wpTotal 305.57 ms +1.15% -0.85% 309.47 ms +0.77% -9.44% -1.26%
wpMemoryUsage 12.79 MB +0% -0% 12.76 MB +0% -0% 0.24%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

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

Should duplicate the widgets in /test/e2e/specs/widgets/editing-widgets.spec.js, passed after 1 failed attempt.

should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:image -->
- <figure class="wp-block-image"><img alt=""/></figure>
+ <!-- wp:image {"id":24,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8891/wp-content/uploads/2026/11/424e49d3-2730-40cb-99e2-1e2ab59d2698.png" alt="" class="wp-image-24"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:432:49

7bcfd16 Run

@github-actions github-actions Bot added the [Package] Components /packages/components label Nov 11, 2026
@ciampo ciampo self-assigned this Nov 11, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Nov 11, 2026
@ciampo
ciampo requested a review from a team November 11, 2026 14:50
@ciampo
ciampo marked this pull request as ready for review November 11, 2026 14:50
@ciampo
ciampo requested a review from a team as a code owner November 11, 2026 14:50
@jasmussen

Copy link
Copy Markdown
Contributor

Some relevant history in #70674. This solves the same original issue, and perhaps from the approach recommended from the later discussion linked from 70674 that reverted the original variant.

@ciampo

ciampo commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Good cross-reference! Since this PR uses the new WPDS foreground/background pair, they also address the original contrast issue. For example, with the default light-theme colors, the darker label gives about 2.70:1 contrast, compared with 1.36:1 in the reverted change.

Copilot AI 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.

🟢 Approval recommended

No active review issues block the focused migration of disabled Button colors to WordPress Design System tokens.

No open issues 🎉

What changed in this PR

This PR migrates ordinary disabled Button colors to WordPress Design System tokens as a focused step toward broader Button color alignment.

Changes:

  • Uses theme-aware disabled foreground colors and a neutral disabled primary fill.
  • Preserves existing selectors, enabled colors, busy stripes, and pressed-specific overrides.
  • Documents the change in the components changelog.
File Description
packages/​components/​src/​button/​style.scss Replaces disabled color values with WPDS tokens.
packages/​components/​CHANGELOG.md Adds an enhancement entry for disabled Button colors.

Review effort: Balanced

Comment thread packages/components/CHANGELOG.md Resolved
@ciampo
ciampo force-pushed the codex/button-disabled-tokens branch from c4aff03 to fb5d688 Compare November 12, 2026 08:37
@ciampo
ciampo enabled auto-merge (squash) November 12, 2026 09:04
@ciampo
ciampo disabled auto-merge November 12, 2026 09:04
@ciampo
ciampo enabled auto-merge (squash) November 12, 2026 09:05
@ciampo

ciampo commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

PS those neutral / brand WPDS mismatches shouldn't really happen, I'm trying to make agents instructions clearer in #86724

@ciampo
ciampo merged commit ec6c72b into trunk Nov 12, 2026
83 checks passed
@ciampo
ciampo deleted the codex/button-disabled-tokens branch November 12, 2026 09:23
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 12, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
* Button: Use WPDS colors for disabled states

* Button: Link disabled color changelog to its PR

* Button: Align disabled color roles and clarify changelog

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jasmussen <joen@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] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants