wp-build: Fix black flash on wp-admin pages before hydration#78493
Conversation
Use the boot layout background token for #wpwrap critical CSS instead of a foreground color fallback that rendered as near-black before React mounted. Fixes WordPress Core Trac WordPress#65247.
|
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. |
|
|
||
| /* Background colors */ | ||
| #wpwrap { | ||
| background: var(--wpds-color-fg-content-neutral, #1e1e1e); |
|
There is no black background color flashing after this change, so that's good. Before:Screen.Recording.2026-05-21.at.23.14.11.movAfter:Screen.Recording.2026-05-21.at.23.13.32.mov |
Use the boot layout background token for #wpwrap critical CSS instead of a foreground color fallback that rendered as near-black before React mounted. Fixes WordPress Core Trac WordPress#65247.
fbf44e5 to
2286ae1
Compare
Is this true? Isn't the actual background of the rendered page
Also, as another approach, I'm curious what happens if we remove the background color itself from |
Drop the incorrect foreground token background on #wpwrap and rely on the existing body background for pre-hydration paint. Keep overflow-y for the high-zoom admin menu scroll fix from WordPress#73977. Fixes WordPress Core Trac WordPress#65247.
@t-hamano Thanks for the thoughtful review — both points are valid. You're right that the visible Connectors content area uses --wpds-color-bg-surface-neutral on .boot-layout__canvas / __stage, not --wpds-color-bg-surface-neutral-weak on the outer .boot-layout shell. My earlier description was imprecise. I also agree that removing the #wpwrap background is the cleaner fix. Looking at #73977, the #wpwrap rule was moved into critical CSS mainly for overflow-y: auto (the high-zoom admin menu scroll fix). The background: var(--wpds-color-fg-content-neutral, #1e1e1e) was a foreground token mistakenly applied as a background, which caused the black flash. I've updated the PR to: Remove the #wpwrap background entirely Could you take another look when you have a moment? |
t-hamano
left a comment
There was a problem hiding this comment.
LGTM! Finally, could you just resolve the code conflicts?
|
FYI, adding missing changelog entry for this change in #78807 |


What?
Fixes a brief black flash when navigating to wp-admin integrated boot pages (such as the Connectors screen) before React hydrates.
Why?
The
page-wp-admin.php.templatecritical CSS set#wpwrapbackground tovar(--wpds-color-fg-content-neutral, #1e1e1e). That is a foreground design token used as a background, so before@wordpress/boothydrates and applies.boot-layoutstyles, the content area briefly renders as near-black.This matches the boot layout background used after hydration:
How?
Updates
#wpwrapcritical CSS inpackages/wp-build/templates/page-wp-admin.php.templateto usevar(--wpds-color-bg-surface-neutral-weak, #f0f0f0).Generated
page-wp-admin.phpfiles in WordPress Core are built from this template, so the fix must land here rather than by editing generated files directly inwordpress-develop(see Core Trac #65247 and @westonruter's feedback on wordpress-develop PR #11892).Testing Instructions
#f0f0f0) before and after hydration.Related