Description
Overview
- Proposed plugin name: View Transitions
- Proposed plugin slug:
view-transitions
- Proposed plugin owner GitHub username(s): @felixarntz
About the plugin
Purpose
The proposed feature plugin will provide a WordPress-specific API to enable cross-document view transitions via theme support. For the WordPress sites that use the plugin, it will opt these sites in to using that API. The emphasis lies on the "API" because, if this API was merged into WordPress Core, it might be an opt-in theme support feature, just like most other theme support features work.
The use of this plugin will eventually inform the decision-making process, e.g. whether the API's default behavior is suitable for >80% of WordPress sites (and specifically their themes) or not.
The View Transitions API, which the plugin will use under the hood, is a web API that allows creating seamless visual transitions between different URLs on a website. This creates a more visually engaging user experience and enhances perceived performance. It also allows traditional websites to finally compete with native apps in that regard - without the View Transitions API, the only way to achieve smooth transitions on the web was to use an SPA architecture, something that's extremely uncommon and not truly supported in WordPress.
While the View Transitions API can be used for same-document transitions (SPA) and cross-document transitions (MPA), due to the cross-document setup of almost all WordPress sites, the plugin only focuses on the latter.
The View Transitions web API is currently supported by Chromium and Webkit browsers, with Mozilla having indicated support (see caniuse). There is also the W3C specification for cross-document view transitions specifically.
Learn more about the View Transitions API.
Scope
Much of what the plugin would do was initially implemented as an experimental WordPress Core PR:
- new theme support feature
view-transitions
that allows opting in to cross-document view transitions in the site's frontend, with optional configuration arguments supported- when opted in, the plugin would enqueue a script and a stylesheet that enables the behavior
- the stylesheet will opt in via
@view-transition
and define certain transition animations - the script will dynamically determine how to transition exactly, based on the URLs and content navigated between
- defaults that rely on WordPress Core provided markup (either block classes added by Core, or classes from functions like
post_class()
orthe_post_thumbnail()
) to enable config-less appealing view transitions- the primary focus would be on transitioning post titles and post featured images between their singular URLs and their placement within archive URLs
- certain generally static areas like e.g. the URL's
header
would transition individually as well - other transitions could be considered (either to test as a default, or opt-in only), such as slide-in/slide-out when transitioning between two URLs that fall under the same pagination hierarchy (e.g. going from
/blog/page/2/
toblog/page/3
)
- the plugin would automatically opt in the site to use the
view-transitions
theme support feature- for the WordPress default themes, where applicable, it may alter their configuration automatically
- that being said, the ideal outcome is to get appealing view transitions for all of the default themes out of the box (just like for any other theme)
- potentially some of the configuration arguments could be controlled via a settings UI in the plugin
- this would not be taken into account for a potential WordPress Core merge, but it would help with plugin exploration
- it could also be explored to include certain appealing visual animations to select from
Out of scope (at least for the foreseeable future) are view transitions in WP Admin. With much fewer users navigating through the WP Admins of the world, plus an anticipated WP Admin rewrite in the future, it does not make much sense to focus on this at the moment. It could be explored in the long-term future.
Rationale
See above:
This creates a more visually engaging user experience and enhances perceived performance. It also allows traditional websites to finally compete with native apps in that regard - without the View Transitions API, the only way to achieve smooth transitions on the web was to use an SPA architecture, something that's extremely uncommon and not truly supported in WordPress.
While using view transitions does not improve the actual performance of a site, the aspect of perceived performance is quite relevant for user experience too. Additionally, the ability to have smooth transitions between different URLs is kind of revolutionary on its own :)
Enabling view transitions in WordPress Core is a distinct feature that lends itself perfectly to becoming a feature plugin.
Other
Fun fact: A single usage of the View Transitions API is already in WordPress Core (via Gutenberg), for the Site Editor toggle in WP Admin: https://github.com/search?q=repo%3AWordPress%2Fgutenberg%20view-transition-name&type=code
Metadata
Metadata
Assignees
Labels
Type
Projects
Status