Skip to content

Admin UI: Share the content background seed for ThemeProvider - #87839

Merged
ciampo merged 3 commits into
trunkfrom
update/admin-ui-content-background-seed
Dec 3, 2026
Merged

ciampo merged 3 commits into
trunkfrom
update/admin-ui-content-background-seed

Conversation

@ciampo

@ciampo ciampo commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What?

Follow-up to #87818 and #87287.

Adds ADMIN_CONTENT_BACKGROUND (#fcfcfc) to @wordpress/admin-ui as the shared ThemeProvider background seed for the content area of wp-admin apps. The site editor and boot use it instead of hard-coded values.

Why?

The value was hard-coded in several places and had drifted. The site editor seeds its root provider with #fcfcfc, but boot uses #f8f8f8, which predates #81646. Modals, popovers and dropdown menus render through portals and read the root provider, so the two site editors gave them different colors.

How?

  • @wordpress/admin-ui exports ADMIN_CONTENT_BACKGROUND next to getAdminThemeColors(). It matches the ThemeProvider default background seed.
  • edit-site and boot build CONTENT_COLOR from it.
  • Both boot root providers use it instead of #f8f8f8, as the site editor does.

The layout and body backgrounds don't change, because they use the admin color scheme. Portaled surfaces get slightly lighter neutral tokens: --wpds-color-background-surface-neutral goes from #f8f8f8 to #fcfcfc, and their borders from #d7d7d7 to #dbdbdb.

Note

Why a public export in @wordpress/admin-ui

admin-ui already seeds ThemeProvider for the wp-admin apps with getAdminThemeColors(), and both edit-site and boot depend on it. A string constant costs little to keep. Alternatives:

  • Private API in admin-ui: it's a bundled package, and the repository asks bundled packages to use regular exports.
  • Local constants only: no new public API, but two copies that can drift again. This is the fallback if we'd rather not add the export.
  • Let ThemeProvider reset to its default background, or have @wordpress/theme expose its default seeds: this fixes the cause, since the apps only hard-code #fcfcfc to get the default. It changes the theme API and needs its own discussion. If it lands, ADMIN_CONTENT_BACKGROUND can be deprecated.
  • Private API in @wordpress/theme: its privateApis are due for removal in WordPress 7.3.
  • @wordpress/base-styles: it ships only SCSS, and the seed must be a JavaScript string.
  • @wordpress/boot: edit-site would have to depend on the extensible site editor's app shell.

Testing Instructions

  1. Enable Extensible site editor in Gutenberg > Experiments and open /wp-admin/admin.php?page=site-editor-v2.
  2. Open Templates > Add Template, then the Actions menu of a page under Pages. The borders should match the same surfaces in the site editor.
  3. Open Appearance > Fonts. It should look the same as before.
  4. On these screens, getComputedStyle( document.documentElement ).getPropertyValue( '--wpds-color-background-surface-neutral' ) should return #fcfcfc.

Testing Instructions for Keyboard

No interaction changes. Focus rings on the modal and the menu stay visible.

Screenshots

1280×800, Modern admin color scheme. The Fonts screen has no portaled surface open, so its screenshots are identical.

Screen Before After
Add template modal Add template modal before Add template modal after
Page actions menu Page actions menu before Page actions menu after
Appearance > Fonts Fonts screen before Fonts screen after

Use of AI Tools

Claude Code (Claude Opus 5.5) wrote the code, ran the checks, took the screenshots, and drafted this description. A human directed the change and reviews the result.

🤖 Generated with Claude Code

@github-actions github-actions Bot added [Package] Edit Site /packages/edit-site [Package] Boot /packages/boot [Package] Admin UI /packages/admin-ui labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 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: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: mirka <0mirka00@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: -12 B (0%)

Total Size: 8.85 MB

📦 View Changed
Filename Size Change
build/modules/boot/index.min.js 54.8 kB -1 B (0%)
build/scripts/url/index.min.js 3.5 kB -11 B (-0.31%)

06c40f6 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 22db5b4 trunk % Change
timeToFirstByte 61.1 ms +2.45% -3.03% 59.55 ms +5.21% -4.37% 2.6%
largestContentfulPaint 96 ms +6.25% -6.25% 92 ms +4.35% -4.35% 4.35%
lcpMinusTtfb 33.75 ms +21.04% -12.15% 33.3 ms +11.86% -16.22% 1.35%
wpBeforeTemplate 32.05 ms +3.31% -4.74% 30.99 ms +5.16% -4.07% 3.42%
wpTemplate 24.64 ms +5.6% -5.48% 23.81 ms +4.54% -4.37% 3.49%
wpTotal 55.93 ms +4.42% -2.06% 55.29 ms +5.5% -4.16% 1.16%
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 22db5b4 trunk % Change
timeToFirstByte 51 ms +5.59% -4.02% 50 ms +6% -3.9% 2%
largestContentfulPaint 88 ms +4.55% -4.55% 84 ms +4.76% -0% 4.76%
lcpMinusTtfb 36.35 ms +7.02% -3.3% 35.15 ms +4.69% -2.99% 3.41%
wpBeforeTemplate 29.22 ms +4.41% -3.08% 28.2 ms +10.53% -0.89% 3.62%
wpTemplate 18.02 ms +3.27% -2.22% 17.05 ms +9.79% -3.87% 5.69%
wpTotal 47.53 ms +5.3% -3.96% 46.54 ms +5.54% -4.17% 2.13%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 22db5b4 trunk % Change
mediaProcessingJpeg 399.54 ms +0.99% -0.19% 400.8 ms +0.15% -0.77% -0.31%
mediaProcessingAvif 6151.24 ms +0.41% -0.17% 6144.54 ms +0.52% -0.29% 0.11%
mediaProcessingJpegToAvif 4232.06 ms +0.22% -0.24% 4248.5 ms +0.06% -0.08% -0.39%

media-upload

Metric 22db5b4 trunk % Change
jpegUploadProcessing 2005.19 ms +2.42% -19.44% 1511.15 ms +29.57% -1.92% 32.69%
pngUploadProcessing 280.81 ms +7.95% -7.58% 271.25 ms +4.17% -2.82% 3.52%
largeJpegUploadProcessing 1981.15 ms +0.37% -22.97% 1751.03 ms +13.65% -14.02% 13.14%
multipleImageUploadProcessing 2123.41 ms +0.75% -1.1% 2141.26 ms +0.15% -1.61% -0.83%

post-editor

Metric 22db5b4 trunk % Change
serverResponse 484.62 ms +1.23% -7.29% 499.89 ms +5.56% -5.5% -3.05%
firstPaint 385.37 ms +8.73% -6.19% 403.5 ms +17.71% -11.19% -4.49%
domContentLoaded 805.24 ms +8.89% -0.8% 860.69 ms +1.81% -1.62% -6.44%
loaded 806.76 ms +8.89% -0.8% 862.58 ms +1.78% -1.6% -6.47%
firstContentfulPaint 450.24 ms +10.61% -1.77% 475.91 ms +1.87% -1.97% -5.39%
firstBlock 2226.03 ms +2.08% -2.29% 2365.2 ms +0.6% -1.28% -5.88%
type 17.46 ms +9.91% -7.96% 19.68 ms +2.69% -4.22% -11.28%
typeWithoutInspector 18.62 ms +8.86% -9.77% 18.51 ms +8.05% -12.16% 0.59%
typeWithTopToolbar 22.73 ms +5.24% -7.26% 20.32 ms +12.6% -2.81% 11.86%
typeContainer 8.72 ms +9.17% -5.73% 8.64 ms +6.71% -8.68% 0.93%
focus 106.84 ms +24.26% -6.76% 103.33 ms +6.29% -5.84% 3.4%
firstFocus 291.62 ms +0% -0% 272.15 ms +0% -0% 7.15%
selectAll 403.66 ms +0.3% -2.75% 398.8 ms +0.67% -2.75% 1.22%
undo 29.91 ms +3.68% -6.79% 28.27 ms +5.38% -4.67% 5.8%
listViewOpen 37.03 ms +6.81% -2.86% 38.83 ms +3.04% -6.1% -4.64%
inserterOpen 38.56 ms +10.32% -8.48% 41.94 ms +10.3% -15.09% -8.06%
inserterHover 11.36 ms +3.52% -9.24% 10.43 ms +9.2% -7.86% 8.92%
inserterSearch 8.31 ms +3.61% -11.79% 8.6 ms +11.16% -3.84% -3.37%
loadPatterns 677.63 ms +6.68% -2.05% 664.82 ms +4.88% -6.84% 1.93%
wpTotal 474.98 ms +1.27% -8.04% 490.11 ms +5.45% -6.15% -3.09%
wpMemoryUsage 14.80 MB +0% -0% 14.76 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 22db5b4 trunk % Change
serverResponse 244.71 ms +4.83% -8.16% 253.61 ms +3.03% -0.95% -3.51%
firstPaint 293.33 ms +2.82% -1.3% 251.7 ms +16.15% -6.52% 16.54%
domContentLoaded 515.13 ms +2.08% -0.86% 531.11 ms +2.17% -2.35% -3.01%
loaded 516.11 ms +2.08% -0.85% 532.27 ms +2.38% -2.36% -3.04%
firstContentfulPaint 298.17 ms +3.84% -2.9% 290.35 ms +5.22% -0.95% 2.69%
firstBlock 1594.39 ms +3.43% -0.8% 1661.23 ms +1.22% -1.5% -4.02%
type 12.2 ms +3.36% -7.87% 11.9 ms +3.11% -6.81% 2.52%
navigate 82.63 ms +8.44% -1.54% 67.13 ms +9.52% -1.44% 23.09%
loadPatterns 1182.97 ms +1.6% -2.95% 1082.29 ms +6.81% -3.34% 9.3%
loadPages 916.03 ms +2.27% -1.48% 908.42 ms +1.62% -0.83% 0.84%
wpTotal 238.25 ms +5.05% -8.29% 247.33 ms +3.14% -1% -3.67%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

06c40f6 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.

As a user I want to be able to add multiple close buttons so that users can close the overlay from different positions in /test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js, passed after 1 failed attempt.
Error: expect(locator).toHaveCount(expected) failed

Locator:  getByRole('button', { name: 'Close' })
Expected: 2
Received: 1
Timeout:  5000ms

Call log:
  - Expect "toHaveCount" getByRole('button', { name: 'Close' }) with timeout 5000ms
  - waiting for getByRole('button', { name: 'Close' })
    14 × locator resolved to 1 element
       - unexpected value "1"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js:228:33

allows blocks to be added on mobile viewports in /test/e2e/specs/widgets/editing-widgets.spec.js, passed after 1 failed attempt.

page-list submenu user interactions 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:706:4
should restore an older revision in /test/e2e/specs/editor/various/revisions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/revisions.spec.js:120:45

06c40f6 Run

@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Dec 2, 2026
@ciampo
ciampo force-pushed the update/snackbar-adaptive-shadow branch from 7f08f47 to b56546b Compare December 2, 2026 22:12
Base automatically changed from update/snackbar-adaptive-shadow to trunk December 2, 2026 22:51
ciampo and others added 3 commits December 3, 2026 11:39
Export `ADMIN_CONTENT_BACKGROUND` from `@wordpress/admin-ui` and use it
for the content providers in the site editor and boot. Seed the boot
root provider with it as well, so portaled UI in the extensible site
editor matches the site editor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ciampo
ciampo force-pushed the update/admin-ui-content-background-seed branch from 563520c to 06c40f6 Compare December 3, 2026 10:45
@ciampo ciampo self-assigned this Dec 3, 2026
@ciampo
ciampo marked this pull request as ready for review December 3, 2026 10:49

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

No strong feeling about #fcfcfc vs #f8f8f8. I suppose this work makes it easier to tweak later if we want to.

@ciampo

ciampo commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Just wanted to remark the main technical decision here: we're adding the default background seed color to the admin-ui package. I'm still not 100% convinced that's the right approach, and I listed all options that I considered in the PR description.

In particular, I'm still unsure whether the theme package should expose the "default" theme values, or allow a "reset to default values" option / prop.

I'd like to hear thoughts from the rest of @WordPress/gutenberg-components team.

@mirka

mirka commented Dec 3, 2026

Copy link
Copy Markdown
Member

Thanks for thinking through the possibilities!

Another point I might consider is whether ThemeProvider (or rather, our color system) is actually usable with a #fff background seed. I'm assuming it is not, because that would flatten some tokens too far so they are indistinguishable. And the problem we saw with the ThemeProvider usages in the codebase earlier is that consumers assumed "normal white background = #fff". So in that sense, all ThemeProvider consumers will possibly need an appropriate "white background" value, not just consumers who will be building for the WordPress admin UI. If these assumptions are true, I think conceptually wp-theme itself needs to provide a way to set that value, especially when you think about the nested provider scenarios where a consumer needs to reset the colors to the initial default white.

The one problem with that is that the solution would travel with the global wp-theme script, which means consumers would need to wait until they can rely on that mechanism in the WP versions they want to support. So I'm wondering if we would want a two-prong approach where we provide a way in wp-theme as a more long term approach, but also have the value available through admin-ui as a stopgap approach 🤔

@ciampo

ciampo commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

As you mentioned, #fff would flatten the different surface tokens.

If these assumptions are true, I think conceptually wp-theme itself needs to provide a way to set that value, especially when you think about the nested provider scenarios where a consumer needs to reset the colors to the initial default white.

That's my thinking too. Which shape is also interesting: I had thought about a default string keywork for every config, so that the themeprovider would internally pick the right value. WDYT?

So I'm wondering if we would want a two-prong approach where we provide a way in wp-theme as a more long term approach, but also have the value available through admin-ui as a stopgap approach 🤔

That could work: when enough time has passed, then, we'd deprecate / remove the export from admin-ui, I assume?

@ciampo

ciampo commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Opened #87915 for the theme package changes, and I guess we'll still merge this PR since it introduces the stopgap solution we discussed.

I'll just wait for @mirka 's go ahead and merge

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

Yes, let's go with a two-prong approach then, and we can probably remove this side of it in the future.

@ciampo
ciampo merged commit a9f8fbe into trunk Dec 3, 2026
110 of 111 checks passed
@ciampo
ciampo deleted the update/admin-ui-content-background-seed branch December 3, 2026 20:59
@github-actions github-actions Bot added this to the Gutenberg 24.7 milestone Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Admin UI /packages/admin-ui [Package] Boot /packages/boot [Package] Edit Site /packages/edit-site [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants