[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> view-transitions.php (summary)

View Transitions API.

File Size: 70 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  wp_enqueue_view_transitions_admin_css()
  wp_get_view_transitions_admin_css()
  wp_print_view_transitions_render_blocking_link()

Functions
Functions that are not part of a class:

wp_enqueue_view_transitions_admin_css()   X-Ref
Enqueues View Transitions CSS for the admin.

To disable admin View Transitions, dequeue the `wp-view-transitions-admin` style at the
{@see 'admin_enqueue_scripts'} action, rather than unhooking this function.


wp_get_view_transitions_admin_css()   X-Ref
Gets the CSS for View Transitions in the admin.

return: string The CSS.

wp_print_view_transitions_render_blocking_link()   X-Ref
Prints a render-blocking expectation so View Transitions capture a fully parsed admin menu.

A cross-document view transition snapshots the incoming page at its first render, which can
happen before the `<body>` has finished parsing. The snapshot would then capture a partially
built page — for example an incomplete admin menu — and the transition animates to or from
the wrong state.

The `expect` link blocks the first render until `#wpcontent` is parsed. Rendering is unblocked
as soon as the target's start tag is parsed, not its children, so the target is the element
right after the admin menu rather than the menu itself: once `#wpcontent` starts, the whole
menu has been parsed. Targeting an element near the end of the body would also work, but it
would delay the first render by the time it takes to parse all of the page content. The media
query limits the first-render delay to when view transitions can run, matching the
`@view-transition` rule in view-transitions.css. It does not detect whether a transition is
actually in progress, so a reload or a direct visit is also held until `#wpcontent` is parsed,
but since that element starts right after the admin menu, the delay is negligible.

Nothing is printed unless the admin View Transitions style has already been printed, since
there is otherwise no transition to wait for. That style is only enqueued from
wp-admin/admin-header.php, so this also leaves out iframe screens such as Thickbox modals,
which have no `#wpcontent`: an `expect` link whose target never appears blocks the first
render until the whole document has been parsed.




Generated : Mon Nov 9 08:20:01 2026 Cross-referenced by PHPXref