Skip to content

Conversation

@felixarntz
Copy link
Member

@felixarntz felixarntz commented Jan 8, 2026

  • Adds "virtual" CSS asset wp-view-transitions-admin with inline CSS for basic view transitions in WP Admin, including smooth transitions between admin menu items.
  • Enqueues the asset on admin_enqueue_scripts by default.
  • Provides a function with the inline CSS so that it lives in the view-transitions.php file rather than the generic script-loader.php file.
  • CSS is exactly the same as in https://github.com/WordPress/performance/blob/trunk/plugins/view-transitions/includes/admin.php.
  • Tests included.

Trac ticket: https://core.trac.wordpress.org/ticket/64470


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props flixos90.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

* @return string The CSS.
*/
function wp_get_view_transitions_admin_css(): string {
$css = <<<CSS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use nowdoc.

Suggested change
$css = <<<CSS
$css = <<<'CSS'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: Why is it better? For transparency, I have absolutely zero background knowledge about this syntax.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heredocs do variable interpolation and are disallowed by Plugin Check. Nowdocs do no interpolation. Since there are no variables being interpolated, nowdoc is better.

cf. WordPress/plugin-check#1036

$css = <<<CSS
@view-transition { navigation: auto; }
#adminmenu > .menu-top { view-transition-name: attr(id type(<custom-ident>), none); }
CSS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the bump to PHP 7.4 happening momentarily, we'll be able to do this:

Suggested change
CSS;
CSS;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, though I wouldn't want to block this based on that. If it so happens that the PHP 7.4 bump is made before this is ready, I think we can adjust, but otherwise I don't think it's that important.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just bugs me in PHP how the trailing boundary hasn't been able to have the same indent 😄

* @return string The CSS.
*/
function wp_get_view_transitions_admin_css(): string {
$css = <<<CSS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to have this CSS in a file and then load it? See what is being merged soon in #10676

This would enable CSS linting as well as minification.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point! Will update to move this to a CSS file. Just would want to make sure that that file never gets loaded as its own HTTP request since that would be somewhat pointless with its 2 lines or so :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started working on this locally, but I think because this is "very" modern CSS, I think Core's linters don't like it because they're probably outdated.

I'm not familiar with that tooling, so I'm unsure whether we can simply update it or whether that would introduce a new set of problems to address. Do you have any insights on this?

Specifically, it's complaining about the <custom-ident> bit: ") expected" 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, CSS validation in the Customizer and Site Editor are outdated I know. See Core-64418. With the CSS linter, can it be suppressed with a comment? Which tool is failing? Maybe we can update the dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm, I tried adding a src/wp-admin/css/view-transitions.css file containing:

@view-transition {
	navigation: auto;
}
#adminmenu > .menu-top {
	view-transition-name: attr( id type(<custom-ident>), none );
}

Then I ran npm run build:dev and it successfully emitted a src/wp-admin/css/view-transitions.min.css containing:

/*! This file is auto-generated */
@view-transition{navigation:auto}#adminmenu>.menu-top{view-transition-name:attr(id type(<custom-ident>),none)}

So it seems to be working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants