Skip to content

UI: Remove the ThemeProvider compatibility fallback and private APIs dependency - #87837

Merged
ciampo merged 3 commits into
trunkfrom
t3/ui-remove-theme-provider-fallback
Dec 2, 2026
Merged

ciampo merged 3 commits into
trunkfrom
t3/ui-remove-theme-provider-fallback

Conversation

@ciampo

@ciampo ciampo commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What?

Follow-up to #87817. Removes the ThemeProvider compatibility fallback from @wordpress/ui (utils/theme-provider.ts), its lock-unlock.ts module, and the @wordpress/private-apis dependency.

Why?

The fallback resolved ThemeProvider from the private APIs of older @wordpress/theme runtimes. Its only runtime consumer was Tooltip.Popup, which stopped mounting ThemeProvider in #87817. Now only tests use it.

None of the removed modules are exported, so there is no public API change and no dev note.

How?

  • Tests: the six browser tests that wrap content in a theme now import ThemeProvider from @wordpress/theme.
  • Dependency: removes @wordpress/private-apis from package.json, the lockfile and the three tsconfig references.
  • Private API checks: removes the check-private-apis.config.json exceptions that pointed at the deleted file. Tooltip: Invert the theme's neutral tokens instead of nesting a dark ThemeProvider #87817 made them stale, so the "Check private API usage in bundled packages" job fails on trunk until this PR merges.
  • Allowlist: @wordpress/ui stays in the private APIs allowlist, with a "Do not remove" comment. Published versions, such as 0.15.1, still opt in at load time, so plugins bundling them would throw without the entry.
  • Theme compatibility fixture: the README now says the checkout UI package has no fallback or private API access. The published bundle still exercises privateApis.ThemeProvider.

Testing Instructions

  1. Run npm run test:unit:vitest -- packages/ui packages/private-apis. All tests should pass.
  2. Run npm run typecheck -- packages/ui/tsconfig.json and node tools/validation/check-private-apis.mjs. Both should pass.
  3. Run npm run storybook:dev and open Components > @wordpress-ui > Tooltip > Default. The tooltip should look the same as in Tooltip: Invert the theme's neutral tokens instead of nesting a dark ThemeProvider #87817.

Testing Instructions for Keyboard

No interaction changes.

Screenshots

No visual changes.

Use of AI Tools

Written with Claude Code (Claude Opus 5.5), at my direction: Claude made the change, ran the checks, and drafted this description.

🤖 Generated with Claude Code

@github-actions github-actions Bot added [Package] Private APIs /packages/private-apis [Package] UI /packages/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>

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: 0 B

Total Size: 8.73 MB

1f7851d Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 5e7cdea trunk % Change
timeToFirstByte 45.45 ms +8.69% -3.19% 46.15 ms +8.88% -5.42% -1.52%
largestContentfulPaint 72 ms +8.33% -5.56% 76 ms +5.26% -5.26% -5.26%
lcpMinusTtfb 24.05 ms +22.25% -4.37% 27.9 ms +14.87% -11.83% -13.8%
wpBeforeTemplate 23.67 ms +12.8% -2.58% 23.46 ms +17.6% -2.13% 0.9%
wpTemplate 17.98 ms +4.56% -2.17% 18.33 ms +4.31% -7.26% -1.91%
wpTotal 41.94 ms +6.96% -3.27% 42.62 ms +8.68% -5.61% -1.6%
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 5e7cdea trunk % Change
timeToFirstByte 36.55 ms +13.54% -1.64% 38.95 ms +3.59% -5.39% -6.16%
largestContentfulPaint 68 ms +5.88% -5.88% 68 ms +0% -5.88% 0%
lcpMinusTtfb 28.95 ms +6.74% -3.97% 28.6 ms +6.12% -2.45% 1.22%
wpBeforeTemplate 20.22 ms +12.17% -0.99% 20.43 ms +11.8% -1.47% -1.03%
wpTemplate 13.6 ms +4.78% -6.25% 14.28 ms +4.2% -7.49% -4.76%
wpTotal 33.81 ms +13.58% -2.25% 35.27 ms +5.84% -3.94% -4.14%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 5e7cdea trunk % Change
mediaProcessingJpeg 327.78 ms +1.4% -0.84% 327.57 ms +1.25% -0.38% 0.06%
mediaProcessingAvif 4904.3 ms +0.79% -0.34% 4879.49 ms +0.17% -0.33% 0.51%
mediaProcessingJpegToAvif 3391.07 ms +0.28% -0.05% 3390.39 ms +0.39% -0.33% 0.02%

media-upload

Metric 5e7cdea trunk % Change
jpegUploadProcessing 1467.27 ms +0.56% -0.07% 1478.61 ms +1.31% -0.71% -0.77%
pngUploadProcessing 248.9 ms +4.72% -7.79% 246.96 ms +1.92% -3.34% 0.79%
largeJpegUploadProcessing 1445.25 ms +0.59% -0.4% 1453.34 ms +0.28% -1.1% -0.56%
multipleImageUploadProcessing 1552.99 ms +0.88% -1.71% 1543.72 ms +0.65% -1.9% 0.6%

post-editor

Metric 5e7cdea trunk % Change
serverResponse 458.9 ms +5.33% -6.21% 437.25 ms +9.44% -1.76% 4.95%
firstPaint 437.01 ms +10.06% -15.08% 423.58 ms +4.26% -14.9% 3.17%
domContentLoaded 826.1 ms +5.8% -3.11% 797.12 ms +1.37% -1.57% 3.64%
loaded 827.57 ms +5.81% -3.12% 798.66 ms +1.37% -1.55% 3.62%
firstContentfulPaint 464.15 ms +9.65% -4.34% 446.81 ms +3.5% -2.39% 3.88%
firstBlock 2218.84 ms +6.2% -2.51% 2170.88 ms +1.18% -0.71% 2.21%
type 16.45 ms +8.94% -12.28% 16.44 ms +3.77% -12.41% 0.06%
typeWithoutInspector 16.34 ms +4.59% -5.32% 15.88 ms +4.53% -3.9% 2.9%
typeWithTopToolbar 21.26 ms +2.12% -4.09% 22.21 ms +8.96% -9.91% -4.28%
typeContainer 7.94 ms +6.17% -13.6% 7.83 ms +1.79% -6.64% 1.4%
focus 101.91 ms +7.13% -2.77% 102.71 ms +5.83% -5.15% -0.78%
firstFocus 274.05 ms +0% -0% 253.66 ms +0% -0% 8.04%
selectAll 403.31 ms +0.09% -1.75% 407.33 ms +2.43% -3.36% -0.99%
undo 27.34 ms +3.26% -5.56% 27.05 ms +3.84% -5.03% 1.07%
listViewOpen 36.68 ms +13.55% -2.51% 37.08 ms +9.6% -7.12% -1.08%
inserterOpen 36.35 ms +12.96% -6.22% 40.18 ms +6.87% -9.01% -9.53%
inserterHover 10.29 ms +9.62% -5.44% 9.86 ms +11.76% -4.67% 4.36%
inserterSearch 8 ms +12% -10.25% 7.83 ms +1.53% -7.28% 2.17%
loadPatterns 604.79 ms +4.07% -1.32% 619.77 ms +7.13% -3.9% -2.42%
wpTotal 449.1 ms +5.24% -6.48% 427.38 ms +9.69% -1.76% 5.08%
wpMemoryUsage 14.80 MB +0% -0% 14.76 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 5e7cdea trunk % Change
serverResponse 464.03 ms +2.02% -6.49% 465.91 ms +0.44% -8.74% -0.4%
firstPaint 439.19 ms +8.6% -16.37% 461.59 ms +1.62% -8.33% -4.85%
domContentLoaded 832.75 ms +1.04% -2.98% 818.69 ms +0.83% -0.26% 1.72%
loaded 834.13 ms +1.04% -2.95% 820.29 ms +0.83% -0.26% 1.69%
firstContentfulPaint 455.76 ms +4.65% -2.23% 461.59 ms +1.62% -4.11% -1.26%
firstBlock 2577.71 ms +5.01% -1.41% 2576.53 ms +1.18% -1.55% 0.05%
type 17.06 ms +1.64% -7.62% 16.58 ms +11.4% -4.64% 2.9%
navigate 108.57 ms +6.94% -5.77% 108.88 ms +1.47% -3.43% -0.28%
loadPatterns 1413.61 ms +17.36% -11.61% 1574.25 ms +3.68% -3.68% -10.2%
loadPages 961.91 ms +2.17% -3.21% 948.69 ms +4.86% -3.38% 1.39%
wpTotal 454.71 ms +2.07% -6.69% 456.54 ms +0.45% -8.9% -0.4%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

1f7851d 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.

inserts patterns by dragging and dropping from the global inserter in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,10 +1,7 @@
  -<!-- wp:paragraph -->
  -<p>Dummy text</p>
  -<!-- /wp:paragraph -->
  -
  -<!-- wp:query {"queryId":1,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"metadata":{"categories":["posts"],"patternName":"core/query-standard-posts","name":"Standard"}} -->
  +<!-- wp:group {"layout":{"type":"flex","flexWrap":"nowrap"}} -->
  +<div class="wp-block-group"><!-- wp:query {"queryId":1,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"metadata":{"categories":["posts"],"patternName":"core/query-standard-posts","name":"Standard"}} -->
   <div class="wp-block-query"><!-- wp:post-template -->
   <!-- wp:post-title {"isLink":true} /-->
   
   <!-- wp:post-featured-image {"isLink":true,"align":"wide"} /-->
   
  @@ -15,5 +12,10 @@
   <!-- /wp:separator -->
   
   <!-- wp:post-date {"metadata":{"bindings":{"datetime":{"source":"core/post-data","args":{"field":"date"}}}}} /-->
   <!-- /wp:post-template --></div>
   <!-- /wp:query -->
  +
  +<!-- wp:paragraph -->
  +<p>Dummy text</p>
  +<!-- /wp:paragraph --></div>
  +<!-- /wp:group -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:267:49
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":21,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8889/wp-content/uploads/2026/12/ccf87a21-73d1-4965-980f-01c12506af22.png" alt="" class="wp-image-21"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:432:49

1f7851d Run

@ciampo
ciampo force-pushed the t3/tooltip-theme-token-followup branch from bfb887a to 4e57a07 Compare December 2, 2026 22:07
Base automatically changed from t3/tooltip-theme-token-followup to trunk December 2, 2026 22:28
ciampo and others added 3 commits December 2, 2026 23:29
…dependency

No component mounts ThemeProvider since the Tooltip change, so the fallback
and its lock-unlock module have no runtime consumer. Tests import
ThemeProvider from @wordpress/theme directly. Keep @wordpress/ui in the
private APIs allowlist, because published versions still opt in.

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 t3/ui-remove-theme-provider-fallback branch from 063062a to 1f7851d Compare December 2, 2026 22:32
@ciampo ciampo self-assigned this Dec 2, 2026
@ciampo ciampo added the [Type] Code Quality Issues or PRs that relate to code quality label Dec 2, 2026
@ciampo

ciampo commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

I'll merge as soon as required CI checks pass to fix a static analysis error on trunk

@ciampo
ciampo marked this pull request as ready for review December 2, 2026 22:45
@ciampo
ciampo requested review from a team and manzoorwanijk as code owners December 2, 2026 22:45
@ciampo
ciampo merged commit 6482bdf into trunk Dec 2, 2026
109 of 119 checks passed
@ciampo
ciampo deleted the t3/ui-remove-theme-provider-fallback branch December 2, 2026 22:52
@github-actions github-actions Bot added this to the Gutenberg 24.7 milestone Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Private APIs /packages/private-apis [Package] UI /packages/ui [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant