Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Set isAnimating only when prefers-reduced-motion is not enabled
  • Loading branch information
ciampo committed Oct 5, 2021
commit 5a17e725b1a22bd936d00724f9058432488304ba
6 changes: 5 additions & 1 deletion packages/components/src/navigator/use-navigator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* WordPress dependencies
*/
import { useReducedMotion } from '@wordpress/compose';
import { useContext } from '@wordpress/element';

/**
Expand All @@ -14,10 +15,13 @@ import type { Navigator } from './types';
*/
function useNavigator(): Navigator {
const { setLocation, setIsAnimating } = useContext( NavigatorContext );
const prefersReducedMotion = useReducedMotion();

return {
push( path, options ) {
setIsAnimating( true );
if ( ! prefersReducedMotion ) {
setIsAnimating( true );
}
setLocation( { path, ...options } );
},
};
Expand Down