Skip to content

Toolbar, Widgets: Use semantic surface and focus colors - #84573

Merged
ciampo merged 10 commits into
trunkfrom
codex/extract-pressed-controls
Nov 14, 2026
Merged

ciampo merged 10 commits into
trunkfrom
codex/extract-pressed-controls

Conversation

@ciampo

@ciampo ciampo commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Related to #86684. Targets trunk directly; the pressed-control migration remains in #86684.

What?

Use WPDS semantic colors for Toolbar borders and focus rings, the Widgets header background and toolbar dividers, and the Customizer Widgets header background and bottom border.

Why?

Fixed surface colors and legacy focus colors do not follow dark and custom themes.

How?

Replace the remaining color declarations with semantic tokens and use the shared outset-ring__focus() mixin for Toolbar focus. The outline keeps the inset toolbar rectangle and standard offset used by the design system.

Testing Instructions

  1. In Storybook, open Components → @wordpress-components → Toolbar → Default, Without Group, and Unstyled. Try light, dark, and custom themes. Check the border and focus ring on pressed and unpressed buttons, including the first and last controls.
  2. In the post editor, add a paragraph and toggle Bold. Check the focused Bold button with the floating toolbar, then enable Options → Appearance → Top toolbar. Repeat at a narrow viewport. The complete focus ring should remain visible.
  3. Repeat the Toolbar focus checks with forced colors enabled. Both the outline and the pressed state should remain visible.
  4. With Twenty Twenty-One active, open Appearance → Widgets, select a heading, and enable Top toolbar in Options. Check the header background and the dividers between block-toolbar groups.
  5. Open Appearance → Customize → Widgets → Footer. Check the header background and bottom border.

Testing Instructions for Keyboard

Use Tab to enter the Toolbar and Left/Right Arrow to move between controls. Check that the focus ring remains visible in light, dark, and custom themes. In the post editor, use Alt+F10 to enter the block toolbar and Space to toggle Bold. In Widgets and the Customizer, use Tab to reach the header controls.

Screenshots or screencast

Compared the previous PR head 9eefe479f44 with this update in Chromium. These matching compositions use production Toolbar, ToolbarButton, ToolbarGroup, and ThemeProvider components. Bold is pressed and has keyboard focus. Screenshots show the toolbar detail at 2× resolution, including its clipping container edges.

Mode Before After
Light Pressed Bold before, light Pressed Bold after, light
Dark Pressed Bold before, dark Pressed Bold after, dark
Custom purple background and green primary Pressed Bold before, custom Pressed Bold after, custom
Forced-colors emulation Pressed Bold before, forced colors Pressed Bold after, forced colors
Editor focus and clipping verification

Verified the production build in Chromium with Twenty Twenty-One. Focused Bold remained visible before and after toggling its pressed state. Pressed-button focus passed in floating and fixed toolbars, including at 390px viewport width. First and last controls passed clipping checks. Grouped, ungrouped, unstyled, and vertical component compositions also passed in light, dark, custom, and forced-colors modes. Forced colors used browser emulation.

Screen After
Floating toolbar, 1280 × 900 Pressed Bold in floating block toolbar
Fixed toolbar, forced colors, 1280 × 900 Pressed Bold in fixed toolbar with forced colors
Narrow editor, 390 × 844 Pressed Bold in narrow editor toolbar
Running Widgets editor and Customizer

Both use the same isolated Twenty Twenty-One site at 1280 × 900. Before and after load the corresponding compiled styles. Widgets shows a selected heading with Top toolbar enabled; the Customizer shows Widgets → Footer.

Screen Before After
Widgets header Widgets header before Widgets header after
Customizer Widgets Customizer Widgets before Customizer Widgets after

Use of AI Tools

Codex helped rescope the changes, verify them, update this description, and capture the browser comparisons.

@github-actions github-actions Bot added [Package] Components /packages/components [Package] Editor /packages/editor [Package] Edit Widgets /packages/edit-widgets labels Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 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: jameskoster <jameskoster@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.65 MB

📦 View Changed
Filename Size Change
build/styles/components/style-rtl.css 18.1 kB -8 B (-0.04%)
build/styles/components/style-rtl.min.css 15.2 kB -8 B (-0.05%)
build/styles/components/style.css 18.2 kB -7 B (-0.04%)
build/styles/components/style.min.css 15.2 kB -7 B (-0.05%)
build/styles/customize-widgets/style-rtl.css 3.08 kB +14 B (+0.46%)
build/styles/customize-widgets/style-rtl.min.css 2.06 kB +14 B (+0.69%)
build/styles/customize-widgets/style.css 3.08 kB +14 B (+0.46%)
build/styles/customize-widgets/style.min.css 2.05 kB +14 B (+0.69%)
build/styles/edit-widgets/style-rtl.css 5.41 kB +21 B (+0.39%)
build/styles/edit-widgets/style-rtl.min.css 3.99 kB +19 B (+0.48%)
build/styles/edit-widgets/style.css 5.4 kB +23 B (+0.43%)
build/styles/edit-widgets/style.min.css 3.99 kB +21 B (+0.53%)

815e4c1 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 1726111 trunk % Change
timeToFirstByte 55.4 ms +6.41% -3.97% 55.7 ms +3.41% -4.94% -0.54%
largestContentfulPaint 84 ms +9.52% -0% 86 ms +2.33% -2.33% -2.33%
lcpMinusTtfb 29.05 ms +14.11% -5.85% 29.3 ms +19.8% -7.34% -0.85%
wpBeforeTemplate 29.14 ms +12.56% -3.6% 28.98 ms +7.25% -2.07% 0.55%
wpTemplate 21.96 ms +4.37% -3.6% 22.09 ms +4.07% -4.35% -0.59%
wpTotal 51.53 ms +6.68% -4.5% 52 ms +3.71% -4.9% -0.9%
wpMemoryUsage 7.75 MB +0% -0% 7.71 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 1726111 trunk % Change
timeToFirstByte 46.65 ms +7.5% -2.57% 46.1 ms +5.97% -1.84% 1.19%
largestContentfulPaint 82 ms +4.88% -2.44% 80 ms +2.5% -0% 2.5%
lcpMinusTtfb 35.25 ms +3.83% -4.4% 33.9 ms +3.69% -4.72% 3.98%
wpBeforeTemplate 26.39 ms +12.5% -1.17% 25.98 ms +11.01% -0.89% 1.58%
wpTemplate 16.27 ms +7.13% -3.87% 16.54 ms +2.84% -1.87% -1.63%
wpTotal 43.42 ms +8.13% -2.07% 43.14 ms +6.12% -2.53% 0.65%
wpMemoryUsage 6.44 MB +0% -0% 6.40 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 1726111 trunk % Change
mediaProcessingJpeg 396.64 ms +1.03% -0.4% 398.63 ms +0.36% -0.58% -0.5%
mediaProcessingAvif 6185.19 ms +0.36% -0.26% 6168.15 ms +0.09% -0.56% 0.28%
mediaProcessingJpegToAvif 4265.82 ms +0.27% -0.15% 4243.53 ms +0.09% -0.58% 0.53%

media-upload

Metric 1726111 trunk % Change
jpegUploadProcessing 2001.24 ms +0.84% -23.91% 1511.48 ms +4.84% -0.76% 32.4%
pngUploadProcessing 270.22 ms +6.35% -4.29% 265.93 ms +2.22% -1.77% 1.61%
largeJpegUploadProcessing 1727.99 ms +14.36% -13.32% 1494.87 ms +0.97% -0.39% 15.59%
multipleImageUploadProcessing 2084.61 ms +3.8% -5.73% 2058.98 ms +1.09% -5.33% 1.24%

post-editor

Metric 1726111 trunk % Change
serverResponse 276.41 ms +6.95% -5.61% 273.34 ms +3.18% -8.54% 1.12%
firstPaint 323.63 ms +10.16% -5.75% 295.71 ms +5.08% -3.49% 9.44%
domContentLoaded 604.37 ms +3.95% -2.01% 563.14 ms +1.98% -1.21% 7.32%
loaded 605.3 ms +3.94% -2.01% 564.01 ms +1.98% -1.21% 7.32%
firstContentfulPaint 354.89 ms +4.75% -2.54% 322.83 ms +1.87% -2.22% 9.93%
firstBlock 1594.93 ms +4.02% -1.9% 1478.67 ms +2.17% -2.59% 7.86%
type 15.55 ms +5.92% -5.14% 14.11 ms +11.41% -6.02% 10.21%
typeWithoutInspector 13.36 ms +14.07% -1.2% 12.82 ms +3.12% -6.01% 4.21%
typeWithTopToolbar 17.51 ms +4.11% -5.48% 17.46 ms +12.94% -5.1% 0.29%
typeContainer 6.63 ms +2.56% -8.45% 6.11 ms +3.44% -14.89% 8.51%
focus 88.62 ms +3.49% -4.08% 80.04 ms +2.27% -4.7% 10.72%
firstFocus 198.85 ms +0% -0% 163.01 ms +0% -0% 21.99%
selectAll 261.99 ms +4.59% -4.21% 233.73 ms +3.31% -2.07% 12.09%
undo 22.79 ms +11.5% -4.87% 20.69 ms +8.84% -6.67% 10.15%
listViewOpen 54.13 ms +4.8% -10.51% 46.74 ms +7.74% -10.18% 15.81%
inserterOpen 30.14 ms +5.44% -4.88% 28.67 ms +6.84% -1.92% 5.13%
inserterHover 8.03 ms +12.08% -8.47% 8.65 ms +5.32% -6.94% -7.17%
inserterSearch 6.23 ms +9.63% -6.1% 6.12 ms +11.27% -2.12% 1.8%
loadPatterns 406.95 ms +1.76% -1.05% 425.2 ms +6.05% -3.79% -4.29%
wpTotal 269.24 ms +7.13% -5.75% 266.32 ms +3.28% -8.82% 1.1%
wpMemoryUsage 14.81 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 1726111 trunk % Change
serverResponse 499.31 ms +1.03% -5.91% 463.59 ms +0.56% -6.67% 7.71%
firstPaint 431.6 ms +4.17% -9.93% 429.51 ms +8.75% -9.08% 0.49%
domContentLoaded 832.77 ms +2.57% -1.2% 814.34 ms +0.84% -0.3% 2.26%
loaded 833.96 ms +2.57% -1.23% 815.2 ms +0.84% -0.3% 2.3%
firstContentfulPaint 466.69 ms +3.57% -2.63% 466.52 ms +1.16% -1.82% 0.04%
firstBlock 2559.94 ms +1.48% -0.64% 2549.5 ms +0.12% -1% 0.41%
type 17.71 ms +5.7% -5.25% 16.9 ms +6.04% -7.99% 4.79%
navigate 119.85 ms +1.04% -4.11% 113.31 ms +9.97% -4.68% 5.77%
loadPatterns 1279.38 ms +2.14% -4.24% 1201.45 ms +18.69% -7.11% 6.49%
loadPages 943.61 ms +2.99% -2.25% 935.52 ms +1.88% -1.34% 0.86%
wpTotal 488.46 ms +1.36% -5.75% 453.99 ms +0.6% -6.81% 7.59%
wpMemoryUsage 12.82 MB +0% -0% 12.79 MB +0% -0% 0.25%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

815e4c1 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.

Submenu interactions on 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
    16 × 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:279:4
should reset a named font size using input field in /test/e2e/specs/editor/various/font-size-picker.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:paragraph {"fontSize":"small"} -->
+ <!-- wp:paragraph {"fontSize":"tiny"} -->
- <p class="has-small-font-size">Paragraph with font size reset using input field</p>
+ <p class="has-tiny-font-size">Paragraph with font size reset using input field</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/font-size-picker.spec.js:216:6
should reset a named font size using the tools panel menu in /test/e2e/specs/editor/various/font-size-picker.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:paragraph {"fontSize":"medium"} -->
+ <!-- wp:paragraph {"fontSize":"small"} -->
- <p class="has-medium-font-size">Paragraph with font size reset using tools panel menu</p>
+ <p class="has-small-font-size">Paragraph with font size reset using tools panel menu</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/font-size-picker.spec.js:178:6

815e4c1 Run

@ciampo ciampo self-assigned this Oct 12, 2026
@ciampo
ciampo force-pushed the codex/extract-pressed-controls branch 2 times, most recently from e9351f0 to 9ac2e29 Compare October 16, 2026 14:34
@ciampo

ciampo commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@jameskoster early ping to get some initial design feedback, these are changes extracted from #82294

@jameskoster

Copy link
Copy Markdown
Contributor

Does this mean a disabled pressed button would look the same as a disabled _un_pressed button? 🤔

@ciampo

ciampo commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

They already do in @wordpress/ui - pressed button basically looks the same as the solid neutral button (play around with https://wordpress.github.io/gutenberg/?path=/story/design-system-components-button--all-tones-and-variants and the aria-pressed control) — which is kind of related to the points I made in #82260

If this is something we don't like, we should agree on a spec, work out any missing WPDS tokens need, and apply it to @wordpress/ui, too

@jameskoster

Copy link
Copy Markdown
Contributor

They already do in @wordpress/ui

That's not what I see. Currently a disabled pressed button has a background, but a disabled not-pressed button doesn't.

@ciampo

ciampo commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

My bad, I could have been more detailed.

What I was meant to say is that in @wordpress/ui:

  • currently, aria-pressed={true} only changes the appearance of the minimal, neutal buttons. Other variants are not visually affected
  • a disabled (minimal, neutral) pressed button looks the same as any other disabled solid buttons (regardless of their tone or pressed state)
  • a disabled (minimal, neutral) pressed button looks different from a disabled (minimal, neutral) non-pressed button

@jameskoster

Copy link
Copy Markdown
Contributor

Ah, yes, I think that's okay. My main concern is that the pressed/unpressed states should be visually different for the minimal, neutral button.

@ciampo
ciampo force-pushed the codex/extract-pressed-controls branch from 9ac2e29 to 143561e Compare October 20, 2026 15:39
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Oct 20, 2026
@ciampo

ciampo commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Yep, that's preserved for the default @wordpress/components Button in this PR. Pressed buttons keep a background when disabled, while unpressed buttons stay transparent.

image

@ciampo
ciampo marked this pull request as ready for review October 20, 2026 16:06
@ciampo
ciampo requested a review from a team as a code owner October 20, 2026 16:06
@ciampo
ciampo force-pushed the codex/extract-pressed-controls branch from 143561e to 3d58ed2 Compare October 28, 2026 14:00
@github-actions github-actions Bot removed the [Package] Editor /packages/editor label Nov 13, 2026
@ciampo ciampo changed the title Components: Match pressed control colors across themes Toolbar, Widgets: Use semantic surface and focus colors Nov 13, 2026
@ciampo

ciampo commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Retargeted to only Toolbar borders/focus rings and Widgets/Customizer header colors, since #86684 now takes care of pressed states

@ciampo
ciampo requested review from a team and Mamaduka November 13, 2026 14:44
@github-actions
github-actions Bot requested a review from aduth November 13, 2026 15:51
@ciampo

ciampo commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Changes feel now simple and self-contained enough to be mergeable without a formal approval, especially as it will save some previous review time that can be dedicated to more complex PRs. Always happy to follow-up if any feedback comes through.

@ciampo
ciampo merged commit f7e93c7 into trunk Nov 14, 2026
88 checks passed
@ciampo
ciampo deleted the codex/extract-pressed-controls branch November 14, 2026 13:36
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] Edit Widgets /packages/edit-widgets [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants