Repository navigation
Site Editor: Use inverted ThemeProvider seed for portaled UI - #81296
Conversation
c4ec8c9 to
930b90d
Compare
| <ThemeProvider color={ themeColors }> | ||
| <Layout { ...props } /> | ||
| <ThemeProvider | ||
| isRoot |
There was a problem hiding this comment.
are we guaranteed that there won't be any other isRoot theme providers in the same browser page?
There was a problem hiding this comment.
Based on my research, Gutenberg itself should not cause duplicate theme providers with isRoot. The only possibility is if a third party injects its own theme provider with isRoot, but I believe this could happen in all editors, not just the Site Editor.
There was a problem hiding this comment.
Aside: We have console logging that emits in development environments in this kind of situation where duplicate isRoot exists, but maybe these could be throwing errors so this class of issue is more easily identified?
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
aduth
left a comment
There was a problem hiding this comment.
LGTM 👍 Confirmed that this fixed an issue with focus rings not following color scheme in popovers in the Site Editor, and that the approach makes sense as essentially following what other themed page roots like @wordpress/boot's Root is already doing.
| Before | After |
|---|---|
![]() |
![]() |
There was a problem hiding this comment.
Changes LGTM 🚀
Should we add a CHANGELOG entry for the @wordpress/edit-site package?
My preference (which can be a follow-up, if this PR needs to be merged soon) would be to add some resilience to the changes by:
- potentially throwing in
ThemeProvider(in dev mode) when multipleisRootproviders run in the same document; - potentially adding a side editor e2e test to verify that portalled components behave as expected with the changes from this PR (there are already popover-focused e2e tests, we could add another one);
|
Thanks for the review, everyone. I would like to merge this after adding the changelog, in order to include it in tomorrow's 7.1 RC3 release. |
By the way I consider this "inverted" approach in this PR basically as a hack, and not something we want to immortalize specifically in a test. The inverted approach only works for a specific, simple nesting structure, and will not work the moment there's a portaled dropdown coming from the dark sidebar for example, or more layers of nesting. |
Agreed! I thought we could add a test that will continue to work even after we refactor away from the hack |
|
Size Change: +14 B (0%) Total Size: 7.75 MB 📦 View Changed
|
|
Please note that the CI error is unrelated to this PR. #81444 (comment) |
|
Should we bypass checks and merge, if all other checks pass? |
|
Flaky tests detected in cc2a0fc. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/31558780159 adds and activates a new tab when pressing Enter at the end of a tab label in
|
I've updated this PR because #81444 was just backported to the |
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`. A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@ea285b4...b9743a0 - Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277) - Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265) - Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291) - Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308) - theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253) - theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309) - Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311) - Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320) - Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374) - Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375) - Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385) - fix: order site identity changes predictably (WordPress/gutenberg#81283) - Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444) - components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446) - Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406) - Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296) Props wildworks. See #65529. git-svn-id: https://develop.svn.wordpress.org/branches/7.1@63209 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`. A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@ea285b4...b9743a0 - Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277) - Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265) - Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291) - Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308) - theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253) - theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309) - Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311) - Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320) - Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374) - Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375) - Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385) - fix: order site identity changes predictably (WordPress/gutenberg#81283) - Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444) - components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446) - Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406) - Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296) Props wildworks. See #65529. Built from https://develop.svn.wordpress.org/branches/7.1@63209 git-svn-id: http://core.svn.wordpress.org/branches/7.1@62402 1a063a9b-81f0-0310-95a4-ce76da25c4cd


What?
Uses an inverted
ThemeProviderseed in the site editor layout so portaled popovers and modals receive admin color scheme tokens.Alternative to #81183 for the 7.1 release branch.
Why?
Portaled popovers and modals render outside their ancestor
ThemeProviderwrapper in the DOM, so they do not receive the CSS custom properties on that wrapper. In the site editor, WPDS-styled UI inside popovers and modals can therefore miss the chosen admin color scheme's primary/accent colors.#81183 fixes this at the
Popover/Modallevel by wrapping portaled content inThemeProvider. That is the more general long-term fix, but for 7.1 we want a smaller change that avoids adding an extra wrapper to widely used components this close to release.This follows the inverted seed pattern suggested by @t-hamano in #81183 (review), already used in the boot package: an outer
isRootprovider seeds accent + content background for portaled UI, while an inner provider applies the full admin scheme to the editor chrome.How?
ThemeProviderwithisRoot, seedingprimaryfrom the admin color scheme and a white content background (CONTENT_COLOR).ThemeProvider color={ themeColors }inside it for the site editor chrome.Testing Instructions
npm start)./wp-admin/site-editor.php).