Refine the admin menu view transition animation#11912
Conversation
Clip each top-level menu item's view transition snapshot to its animating group box. By default a captured snapshot keeps its full intrinsic height, so a newly expanded submenu painted at full height from the first frame and overlapped the menu items below while they were still sliding into place. Setting `overflow: clip` on the image pair makes the submenu wipe open, and closed in reverse, in step with those items. Also name the collapse button so it slides into place with the menu items rather than cross-fading via the page root, and add comments explaining each rule. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
In the following videos, I have a plugin active which slows down the animations to make them more observable: add_action(
'admin_print_styles',
function () {
?>
<style>
/* TEMP DEBUG: slow every view transition animation down to 2s. Remove before shipping. */
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
animation-duration: 1s;
}
</style>
<?php
}
);Before:Screen.Recording.2026-05-20.at.16.26.37.movAfter:Screen.Recording.2026-05-20.at.16.28.04.mov |
A cross-document view transition snapshots the incoming page at its first render, which can occur before the body has finished parsing. When that happens the admin menu is only partially built in the snapshot, so the menu-top elements have no height delta and the section accordion silently degrades to a plain cross-fade. Print a render-blocking `<link rel="expect">` pointed at the end of the body, so the first render — and therefore the transition's snapshot — waits until the page is fully parsed. The media query scopes the small first-render delay to when view transitions run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diagnosing the intermittent accordion failureSymptom. Navigating between admin sections, the menu "accordion" (one section's submenu collapsing as the next expands) usually played, but intermittently degraded to a plain cross-fade with no movement. It was hard to reproduce — and, crucially, it happened more often with DevTools closed. Ruled out along the way:
Instrumentation. A temporary Root cause. Every captured failure showed the same two things: A cross-document view transition snapshots the incoming page at its first render, and the browser paints incrementally — so first paint (and therefore the snapshot) can happen before the Fix. A render-blocking expectation in the admin <link rel="expect" href="#wpfooter" blocking="render" media="(prefers-reduced-motion: no-preference)">This holds the first render — and so the view transition's snapshot — until The two CSS refinements in the first commit — clipping each menu item's snapshot so a submenu wipes open/closed instead of overlapping the items below, and naming |
…hould return string but returns string|false.
There was a problem hiding this comment.
Pull request overview
This PR refines wp-admin view-transition behavior so the admin menu accordion animation is captured after the page is fully parsed, clips submenu snapshots during expansion/collapse, and includes the collapse button in the menu transition.
Changes:
- Adds a render-blocking
rel="expect"link in admin head for complete-page transition snapshots. - Adds CSS transition grouping/clipping for top-level admin menu items.
- Names the collapse menu item for independent view-transition animation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/wp-includes/view-transitions.php |
Adds the render-blocking link printer and hardens CSS file reading to return a string. |
src/wp-includes/default-filters.php |
Hooks the new render-blocking link output into admin_head. |
src/wp-admin/css/view-transitions.css |
Adds menu item transition classes, collapse button naming, and snapshot clipping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@mukeshpanchal27 How's this look to you? |
…sition-improvements * origin/trunk: (53 commits) REST API: Allow-list ability schema response keywords Plugins: Fix plugin card width calculation on the Add Plugins screen. Build/Test Tools: Remove unused reusable workflow. Editor: add responsive global styles for blocks. Build/Test Tools: Configure Composer caching with input where possible. Twenty Eleven: Add missing documentation for some global variables. Abilities API: Add coverage for top-level `required` in input validation Abilities API: Add coverage for ignored schema `validate_callback`/`sanitize_callback` HTML API: Fixes for issues discovered while fuzzing. Twenty Ten: Add missing documentation for some global variables. Privacy: Correct type of `WP_User_Request::$user_id` from `int` to `string`/`numeric-string`. Charset: Add missing `return` statement to `_mb_ord()`. Docs: Add missing @SInCE tags to WP_REST_Icons_Controller. Docs: Add missing @SInCE tags to `WP_Icons_Registry`. KSES: Decode style attribute before sending to safecss_filter_attr(). Twenty Sixteen: Correct display of italics in citations. Docs: Correct some typos in JS inline comments and DocBlocks. Docs: Remove duplicate documentation for the `rest_block_hooks_post_types` hook. Docs: Fix typo in `WP_Query` post-loading comment. Media: Re-introduce client-side media processing feature. ...
…link()`. Covers that the function is hooked at `admin_head` and that it prints a single render-blocking `<link rel="expect">` tag with the expected attributes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Trac ticket: https://core.trac.wordpress.org/ticket/65032
When view transitions were enabled throughout wp-admin in 7.0, each top-level admin menu item was given a stable
view-transition-name, so navigating between sections animates them into place (the "accordion" effect). Three rough edges remained:<body>has finished parsing. The snapshot then captures a half-built admin menu, so the menu items have no height delta and the accordion silently degrades to a plain cross-fade. It reproduces most easily with DevTools closed;pagerevealinstrumentation confirmed the snapshot being taken atreadyState: "loading"with an incomplete menu.#collapse-menu) was not named, so it cross-faded as part of the page root instead of moving with the rest of the menu.Changes
<link rel="expect" href="#wpfooter" blocking="render" media="(prefers-reduced-motion: no-preference)">in the admin<head>, so the first render — and therefore the transition's snapshot — waits until the page is fully parsed. The snapshot then always captures a complete menu and the accordion runs reliably. Themediaquery scopes the small first-render delay to when view transitions actually run.view-transition-class(wp-menu-top) to every top-level menu item and setoverflow: clipon::view-transition-image-pair(.wp-menu-top). This clips each menu-top's snapshot to its animating group box, so an expanding submenu wipes open from the link row to full height — and wipes closed in reverse — in step with the items below it, instead of overlapping them.#collapse-menuits ownview-transition-nameso it slides into place with the menu items rather than cross-fading via the root.Files changed:
src/wp-admin/css/view-transitions.css,src/wp-includes/view-transitions.php,src/wp-includes/default-filters.php.Testing instructions