Skip to content

Components: Use theme colors in Panel and ToolsPanel - #87427

Merged
ciampo merged 4 commits into
trunkfrom
extract/panel-colors-82294
Nov 26, 2026
Merged

ciampo merged 4 commits into
trunkfrom
extract/panel-colors-82294

Conversation

@ciampo

@ciampo ciampo commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Extracted from #82294. This change can land on trunk independently.

What?

Make Panel and ToolsPanel follow the active theme. Panel surfaces, borders, toggle labels, icons, chevrons, and ToolsPanel menu labels now use WPDS color tokens directly.

Why?

Fixed white surfaces and gray controls stand out in dark and custom themes. A panel toggle, its icon, and its chevron should also respond together to hover and keyboard focus.

How?

Use the WPDS tokens directly, not the components theme variables, and pair them as the token guide recommends. Some colors change slightly as a result.

  • The panel uses background-surface-neutral-strong with foreground-content-neutral, as Card in @wordpress/ui does.
  • The toggle follows the minimal neutral Button pairing: foreground-interactive-neutral with its -active and -disabled states, over a background-interactive-neutral-weak-active hover fill. The chevron inherits the toggle color.
  • The section icon is part of the toggle, so it uses foreground-interactive-neutral-weak with the matching -active and -disabled states.
  • ToolsPanel menu items use foreground-interactive-neutral and its -disabled state. An unused rule for the reset label of disabled items is removed, because those items never render that label.

Testing Instructions

In Storybook, open Panel → With Icon and switch between light and dark themes. Hover the section title: the label, the icon, and the chevron darken together. Open Panel → Disabled section and check that the toggle looks disabled. Open ToolsPanel → Default and open the options menu: the default controls look disabled and Scale looks enabled.

Testing Instructions for Keyboard

Tab to the Panel toggle and press Space to expand and collapse it. In ToolsPanel, open the menu with Enter, use the arrow keys to move through the controls, and close it with Escape.

Screenshots

Panel → With Icon is shown with the section toggle hovered. ToolsPanel → Default is shown with its options menu open.

Light theme (default)

Before After
Panel on trunk in the light theme: blue hovered label, gray icon Panel in the light theme: hovered label, icon, and chevron in the same dark color
ToolsPanel on trunk in the light theme: options menu with gray disabled items ToolsPanel in the light theme: options menu with disabled items in the disabled token color

Dark theme

Before After
Panel on trunk in the dark theme: white surface, blue hovered label, gray icon Panel in the dark theme: dark surface, hovered label, icon, and chevron in the same light color
ToolsPanel on trunk in the dark theme: white panel behind a dark menu ToolsPanel in the dark theme: dark panel and menu with themed disabled items

Use of AI Tools

OpenAI Codex extracted the changes from #82294. Claude Code switched the styles to WPDS tokens, captured the screenshots, and updated this description.

@github-actions github-actions Bot added the [Package] Components /packages/components label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 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: Mamaduka <mamaduka@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: +240 B (0%)

Total Size: 8.72 MB

📦 View Changed
Filename Size Change
build/scripts/components/index.min.js 356 kB -49 B (-0.01%)
build/scripts/edit-site/index.min.js 384 kB +3 B (0%)
build/styles/components/style-rtl.css 18.6 kB +82 B (+0.44%)
build/styles/components/style-rtl.min.css 15.7 kB +59 B (+0.38%)
build/styles/components/style.css 18.7 kB +85 B (+0.46%)
build/styles/components/style.min.css 15.7 kB +60 B (+0.38%)

0357be4 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric d0c074b trunk % Change
timeToFirstByte 49.6 ms +7.56% -2.22% 48.85 ms +7.16% -1.74% 1.54%
largestContentfulPaint 82 ms +9.76% -7.32% 78 ms +7.69% -2.56% 5.13%
lcpMinusTtfb 29.75 ms +28.24% -8.24% 28.6 ms +8.57% -5.77% 4.02%
wpBeforeTemplate 24.48 ms +9.44% -1.84% 24.53 ms +6.77% -2.73% -0.2%
wpTemplate 21.08 ms +4.6% -4.17% 20.43 ms +4.55% -2.89% 3.18%
wpTotal 45.69 ms +7.7% -2.04% 45.12 ms +6.96% -2.35% 1.26%
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 d0c074b trunk % Change
timeToFirstByte 41.05 ms +2.8% -1.34% 42.05 ms +5.47% -3.92% -2.38%
largestContentfulPaint 76 ms +0% -5.26% 76 ms +5.26% -5.26% 0%
lcpMinusTtfb 33.8 ms +4.73% -4.73% 33.75 ms +4.89% -5.63% 0.15%
wpBeforeTemplate 21.84 ms +4.17% -2.34% 21.82 ms +5.55% -2.2% 0.09%
wpTemplate 15.68 ms +3.32% -2.3% 16.73 ms +3.53% -6.99% -6.28%
wpTotal 37.77 ms +3.2% -1.38% 38.41 ms +6.22% -3.02% -1.67%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric d0c074b trunk % Change
mediaProcessingJpeg 397.15 ms +0.71% -0.5% 395.7 ms +0.59% -1.2% 0.37%
mediaProcessingAvif 5792.13 ms +0.57% -0.41% 5773.49 ms +0.49% -0.06% 0.32%
mediaProcessingJpegToAvif 3947.5 ms +0.34% -0.25% 3985.55 ms +0.15% -0.39% -0.95%

media-upload

Metric d0c074b trunk % Change
jpegUploadProcessing 1502.52 ms +32.89% -1.42% 1485.82 ms +0.23% -0.36% 1.12%
pngUploadProcessing 261.73 ms +1.2% -3.5% 250.7 ms +5.4% -1.6% 4.4%
largeJpegUploadProcessing 1491.74 ms +0.95% -0.54% 1487.88 ms +1.13% -0.8% 0.26%
multipleImageUploadProcessing 1655.28 ms +8.86% -1.23% 1657.2 ms +7.89% -0.22% -0.12%

post-editor

Metric d0c074b trunk % Change
serverResponse 340.07 ms +0.79% -11.78% 315.73 ms +4.57% -6.63% 7.71%
firstPaint 326.23 ms +12.19% -4.55% 318.17 ms +6.31% -8.22% 2.53%
domContentLoaded 655.91 ms +1.92% -1.54% 648.73 ms +1.62% -1.42% 1.11%
loaded 656.87 ms +1.94% -1.56% 649.47 ms +1.63% -1.4% 1.14%
firstContentfulPaint 370.33 ms +1.21% -1.17% 369.22 ms +1.86% -3.44% 0.3%
firstBlock 1797.81 ms +5.18% -1.03% 1742.33 ms +2.48% -0.91% 3.18%
type 15.84 ms +0.69% -5.68% 16.58 ms +26.84% -8.32% -4.46%
typeWithoutInspector 14.54 ms +6.74% -5.91% 15.56 ms +5.66% -9.13% -6.56%
typeWithTopToolbar 19.52 ms +9.27% -9.37% 19.61 ms +7.29% -2.09% -0.46%
typeContainer 6.67 ms +9.6% -10.49% 7.31 ms +3.97% -13.41% -8.76%
focus 89.34 ms +10.22% -2.97% 81.19 ms +4.99% -4.45% 10.04%
firstFocus 212.8 ms +0% -0% 202.9 ms +0% -0% 4.88%
selectAll 316.91 ms +5.64% -1.14% 288.01 ms +2.95% -0.07% 10.03%
undo 23.57 ms +9.04% -3.22% 23.83 ms +1.76% -4.91% -1.09%
listViewOpen 31.28 ms +9.37% -4.06% 30.42 ms +4.64% -3.25% 2.83%
inserterOpen 34.08 ms +10.5% -10.68% 31.95 ms +5.98% -9.95% 6.67%
inserterHover 9.74 ms +7.19% -4.41% 9.48 ms +4.11% -10.13% 2.74%
inserterSearch 7.42 ms +4.99% -9.57% 7.19 ms +5.84% -6.68% 3.2%
loadPatterns 519.02 ms +2.85% -3.58% 508.62 ms +4.05% -1.32% 2.04%
wpTotal 331.37 ms +0.8% -12.06% 307.02 ms +4.72% -6.93% 7.93%
wpMemoryUsage 14.81 MB +0% -0% 14.76 MB +0% -0% 0.33%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric d0c074b trunk % Change
serverResponse 482.63 ms +2.71% -7.41% 484.84 ms +0.97% -2.06% -0.46%
firstPaint 469.48 ms +13.3% -5.8% 405.54 ms +10.61% -2.61% 15.77%
domContentLoaded 888.59 ms +4.95% -3.02% 871.94 ms +1.12% -1.67% 1.91%
loaded 889.71 ms +4.93% -3.03% 872.87 ms +1.15% -1.66% 1.93%
firstContentfulPaint 511.34 ms +9.71% -3.72% 483.27 ms +3.57% -3.33% 5.81%
firstBlock 2717.6 ms +6.15% -1.93% 2695.28 ms +1.29% -0.34% 0.83%
type 18.88 ms +4.56% -6.99% 18.62 ms +1.88% -6.44% 1.4%
navigate 125.27 ms +4.59% -7.58% 122.7 ms +8.3% -2.89% 2.09%
loadPatterns 1369.48 ms +17.93% -3.78% 1321.58 ms +11.74% -5.03% 3.62%
loadPages 970.89 ms +3.28% -0.43% 1003.31 ms +1.62% -2.13% -3.23%
wpTotal 473.13 ms +2.66% -7.62% 475.19 ms +1% -2.07% -0.43%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

0357be4 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.

Navigates the list via UP/DOWN arrow keys from action buttons in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' })
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' }) with timeout 5000ms
  - waiting for getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' })
    14 × locator resolved to <button type="button" tabindex="-1" class="components-button is-small" id="view-list-0-178-primary-action-edit-post">Edit</button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:243:5

0357be4 Run

ciampo and others added 2 commits November 26, 2026 09:25
Replace the components theme variables with WPDS surface tokens, and give
the Panel icon and the disabled ToolsPanel reset label the token states that
match their interactive roles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Disabled default control items never render the reset label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ciampo
ciampo marked this pull request as ready for review November 26, 2026 08:35
@ciampo
ciampo requested a review from a team as a code owner November 26, 2026 08:35
@ciampo
ciampo requested review from Mamaduka and t-hamano November 26, 2026 08:35
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Nov 26, 2026
@github-actions
github-actions Bot requested a review from aduth November 26, 2026 08:35
color: $gray-700;
}

.reset-label {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks like this rule never matched a real combination:

  • Item with a value: shows the "Reset" label, and the item is never disabled.
  • Item without a value: disabled, with only a check icon and no "Reset" label.

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

Looks good. Thanks, @ciampo!

@ciampo
ciampo enabled auto-merge (squash) November 26, 2026 10:39
@ciampo
ciampo merged commit 52f7b04 into trunk Nov 26, 2026
132 of 136 checks passed
@ciampo
ciampo deleted the extract/panel-colors-82294 branch November 26, 2026 10:52
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 26, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
* Components: Use theme colors in Panel and ToolsPanel

* Docs: Link changelogs to WordPress#87427

* Components: Use WPDS tokens directly in Panel and ToolsPanel

Replace the components theme variables with WPDS surface tokens, and give
the Panel icon and the disabled ToolsPanel reset label the token states that
match their interactive roles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Components: Remove unused ToolsPanel reset label rule

Disabled default control items never render the reset label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@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.

2 participants