Skip to content

Commit b213343

Browse files
committed
leave default transition, wrap animations with prefers-reduced-motion: no-preference
1 parent ae7bed8 commit b213343

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/view-transitions/includes/theme.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function plvt_load_view_transitions(): void {
304304
plvt_register_view_transition_animations( $animation_registry );
305305

306306
// Use an inline style to avoid an extra request.
307-
$stylesheet = '@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }';
307+
$stylesheet = '@view-transition { navigation: auto; }';
308308
wp_register_style( 'plvt-view-transitions', false, array(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
309309
wp_add_inline_style( 'plvt-view-transitions', $stylesheet );
310310
wp_enqueue_style( 'plvt-view-transitions' );
@@ -317,7 +317,7 @@ function plvt_load_view_transitions(): void {
317317
$default_animation_args = isset( $theme_support['default-animation-args'] ) ? (array) $theme_support['default-animation-args'] : array();
318318
$default_animation_stylesheet = $animation_registry->get_animation_stylesheet( $theme_support['default-animation'], $default_animation_args );
319319
$default_animation_stylesheet = plvt_inject_animation_duration( $default_animation_stylesheet, absint( $theme_support['default-animation-duration'] ) );
320-
wp_add_inline_style( 'plvt-view-transitions', $default_animation_stylesheet );
320+
wp_add_inline_style( 'plvt-view-transitions', '@media (prefers-reduced-motion: no-preference) {' . $default_animation_stylesheet . '}' );
321321

322322
/*
323323
* No point in loading the script if no specific view transition names are configured.

0 commit comments

Comments
 (0)