Skip to content

WP Build Polyfills: keep the boot frame steady on load and across admin navigation - #52235

Merged
dhasilva merged 3 commits into
trunkfrom
jetpack-2561-2574-frame-flash
Sep 16, 2026
Merged

dhasilva merged 3 commits into
trunkfrom
jetpack-2561-2574-frame-flash

Conversation

@dhasilva

@dhasilva dhasilva commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes JETPACK-2574

Proposed changes

Jetpack's wp-build dashboards (Forms, Newsletter, Activity Log, Social, VideoPress, Premium Analytics, Podcast) flash in two places: while the page loads, and when you move to or from one through the admin menu. This keeps the frame steady in both. All three changes live in WP_Build_Admin_Frame, which every WP_Build_Polyfills::register() call already arms.

  • Paint the frame before boot mounts (JETPACK-2574). The @wordpress/build page template's critical CSS sets body.js { background: #fff }, so the area beside the admin menu stays white until boot mounts, then jumps to the admin-menu backdrop around a rounded stage. On desktop (783px and up) the empty [id$="-wp-admin-app"] container now gets that backdrop and a 12px white panel where boot's stage lands. The panel is plain #fff: boot's theme provider whitens the stage on every admin color scheme, while the root surface token is #fcfcfc. Below 783px the template's white already matches boot's full-screen stage, so nothing changes there.
  • Hold a wp-build page's first render until its markup has parsed (JETPACK-2561). WordPress 7.0 turns on cross-document view transitions across wp-admin. The destination was revealed before #wpadminbar and #adminmenumain were parsed, so the transition captured a page without its chrome: every menu item faded out on its own and the page cross-faded into a blank frame. A deferred, render-blocking script in <head> (<script src="data:text/javascript," defer blocking="render">) now holds the reveal until parsing completes.
    • It is printed only when Core's wp-view-transitions-admin stylesheet is enqueued (WordPress 7.0+) and a *-wp-admin-prerequisites script is queued, which the generated page template does on its own page. Elsewhere, first paint is not delayed.
    • It is a classic script, never a module: wp-admin prints its import map in the footer, and Firefox drops import maps that arrive after a module load starts, which leaves @wordpress/boot unresolved.
    • It is echoed directly because the script APIs pass src through esc_url(), which strips data: URLs.
  • Keep boot's stage out of cross-document transitions (JETPACK-2561). The old page's stage snapshot had no counterpart in the new page. Once boot's stylesheet loaded mid-transition, ::view-transition-old(boot--stage):only-child switched it to zoomOut, so the previous screen reappeared in its rounded patch and shrank. When the navigation has a view transition, a pageswap handler adds a class to the root that unnames boot's stage, inspector and canvas surfaces, and pagereveal removes it. Boot's in-app route transitions are unchanged.

Trade-offs:

  • Later first paint. On WordPress 7.0+, a wp-build page's first paint now waits for the document to parse, even with reduced motion on, when Core runs no transition: Core decides that in a CSS media query PHP can't see. On a slow local site that moved it from about 165–200ms to 240–411ms after the first byte; the previous page stays on screen meanwhile.
  • Only arrivals are held. Leaving a wp-build page for a Core screen (Posts, Plugins) can still flash until Core holds its own render. That part belongs upstream.
  • rel=expect rejected. <link rel="expect" blocking="render"> was tried first and held only 3 of 6 navigations in Chrome, so it isn't used.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Use WordPress 7.0+ and Chrome, with reduced motion off in the OS, on a connected site where Jetpack → Forms, Newsletter and Activity Log are available. Those three are wp-build dashboards by default.

Load flash (JETPACK-2574)

  • In DevTools → Performance settings, set CPU to 4× slowdown. In the Network panel, disable the cache.
  • Load Jetpack → Forms, then Newsletter and Activity Log.
  • Before: the area beside the admin menu is white, then jumps to the dark backdrop with a rounded white panel once the app mounts.
  • After: the backdrop and the rounded panel are there from the first paint, and only the content appears inside it. The panel lines up with the app when it renders, with no shift.
  • Narrow the window below 782px and reload. The page should look as it does on trunk: no panel, and a full-width white stage.

Frame flash between pages (JETPACK-2561)

  • Open DevTools → More tools → Animations, and set the playback speed to 10% so the transition is visible.
  • Click between Jetpack → Forms, Newsletter and Activity Log in the admin menu.
  • Before: the admin bar and sidebar wash out, and the previous screen shrinks away inside a rounded patch on top of the next page.
  • After: the admin bar and sidebar stay put, the frame doesn't move or zoom, and only the content cross-fades.
  • On a wp-build page, <head> contains <script id="wp-build-admin-frame-render-hold" src="data:text/javascript," defer blocking="render">. It is absent on other screens, such as Posts or My Jetpack, and on WordPress versions before 7.0.

No regressions

  • In-app route changes inside a dashboard (for example, Forms' Responses and Forms tabs) still animate as on trunk.
  • The block editor and My Jetpack look and behave as on trunk.
  • In Firefox, Forms, Newsletter and Activity Log load normally, with no @wordpress/boot bare-specifier error in the console.

🤖 Generated with Claude Code

https://claude.ai/code/session_014sK5iF6puPdBLBbBVhBB4U

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the jetpack-2561-2574-frame-flash branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack jetpack-2561-2574-frame-flash
bin/jetpack-downloader test jetpack-mu-wpcom-plugin jetpack-2561-2574-frame-flash

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Package] Wp Build Polyfills [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Tests] Includes Tests labels Sep 11, 2026
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Backup plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Boost plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Search plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Social plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Protect plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Videopress plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Premium Analytics plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/wp-build-polyfills/src/class-wp-build-admin-frame.php 60/60 (100.00%) 0.00% 0 💚

Full summary · PHP report · JS report

dhasilva and others added 2 commits September 15, 2026 17:38
Paint boot's stage on the empty app container before it mounts, hold a
wp-build page's first render until its markup has parsed, and keep the
stage out of cross-document view transitions so it no longer zooms out
over the next page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014sK5iF6puPdBLBbBVhBB4U
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014sK5iF6puPdBLBbBVhBB4U
@dhasilva
dhasilva force-pushed the jetpack-2561-2574-frame-flash branch from 55fac16 to 03dc9eb Compare September 15, 2026 20:41
@dhasilva
dhasilva marked this pull request as ready for review September 15, 2026 20:50
@dhasilva
dhasilva requested a review from a team as a code owner September 15, 2026 20:50
@dhasilva dhasilva added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 15, 2026
CGastrell
CGastrell previously approved these changes Sep 16, 2026

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

Verdict: approve. No blockers. Mechanism is sound and I confirmed the gating against WP 7.0.4: wp_enqueue_view_transitions_admin_css is on admin_enqueue_scripts and the template enqueues {slug}-wp-admin-prerequisites there too, so both handles are in the queues by admin_head, and WP_Dependencies::do_items() never clears queue. The generated container has no whitespace text node, so :empty holds. pageswap is the right seam — the old snapshot is captured after handlers run.

The changelog set is also right: of the 12 plugins that bundle the package, stats reaches it only through My Jetpack (not a wp-build page by default), and starter-plugin / mu-wpcom-plugin are excluded by convention. The Activity Log: prefix is correct for backup/boost/protect/search — Boost's and Backup's own modern dashboards are both default-off, so Activity Log is each one's only visible wp-build surface today.

Three non-blocking notes, all about accuracy rather than behavior:

  1. The render hold ignores prefers-reduced-motion. wp-admin/css/view-transitions.css wraps @view-transition { navigation: auto } in @media (prefers-reduced-motion: no-preference), but the style handle is enqueued on every WP 7.0 admin screen. PHP can't see the media query, so a reduced-motion user pays the 240–411ms hold and never gets a transition for it. I don't think that's cleanly fixable — <script> takes no media and rel=expect is already ruled out — so the ask is wording. The docblock on print_render_hold() ("Only where Core enables cross-document view transitions") and the PR's trade-off note both read as if the cost tracks the benefit. Worth saying it is unconditional on WP 7.0+ wp-build pages.

  2. class-wp-build-admin-frame.php:26 is now false. "Pages without a boot layout are unaffected: the selectors match nothing" was true while every selector keyed off .boot-layout--single-page. [id$="-wp-admin-app"]:empty matches before any boot layout exists, and on Jetpack_Activity_Log::render_fallback() (activity-log/src/class-jetpack-activity-log.php:295) where one never appears. Suggest: "Pages without a boot mount container are unaffected: the selectors match nothing."

  3. A container that never mounts keeps the panel forever (class-wp-build-admin-frame.php:98-104). :empty is the only "not mounted yet" signal, so on an asset 404, a boot load error, or the Activity Log fallback above, #wpbody stays pinned to 100vh with the white panel on the backdrop indefinitely. Today that failure reads as a blank white page; after this it reads as a successfully-rendered empty app, which is harder to spot as broken. A one-line note on the rule would save the next reader the rediscovery.

Nothing else: no new sibling-package calls, the one Phan suppression is a justified test no-op, the CSS is logical-property clean, and the new tests pin both gate branches plus the CSS-not-JS approach.

— Terminator

The render hold runs under reduced motion too, the `:empty` selectors
match before any boot layout exists, and a container that never mounts
keeps the panel.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dhasilva

Copy link
Copy Markdown
Contributor Author

@CGastrell Addressed all three in 403bcaf, comment wording only:

  1. print_render_hold() now says the hold runs on every WordPress 7.0+ wp-build page, reduced motion included, and the PR's "Later first paint" trade-off says the same.
  2. The class docblock now reads "Pages without a boot mount container are unaffected."
  3. The panel rule notes that a container that never mounts keeps the panel and passes for an empty app.

Generated by Claude.

@dhasilva
dhasilva merged commit d6c2a95 into trunk Sep 16, 2026
208 of 213 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Package] Wp Build Polyfills [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcomsh [Tests] Includes Tests [Type] Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants