Skip to content
Merged
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
Disable animation if reduced motion is on
  • Loading branch information
noisysocks committed Feb 20, 2024
commit 0de3c9e057b45fbfe3d8fb853c167492abc3af36
8 changes: 8 additions & 0 deletions packages/editor/src/components/document-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { displayShortcut } from '@wordpress/keycodes';
import { store as coreStore } from '@wordpress/core-data';
import { store as commandsStore } from '@wordpress/commands';
import { useRef, useEffect } from '@wordpress/element';
import { useReducedMotion } from '@wordpress/compose';

/**
* Internal dependencies
Expand Down Expand Up @@ -100,6 +101,7 @@ export default function DocumentBar() {
}, [] );

const { open: openCommandCenter } = useDispatch( commandsStore );
const isReducedMotion = useReducedMotion();

const isNotFound = ! document && ! isResolving;
const icon = ICONS[ postType ] ?? pageIcon;
Expand Down Expand Up @@ -137,6 +139,9 @@ export default function DocumentBar() {
}
animate={ { opacity: 1, transform: 'translateX(0%)' } }
exit={ { opacity: 0, transform: 'translateX(15%)' } }
transition={
isReducedMotion ? { duration: 0 } : undefined
}
>
{ __( 'Back' ) }
</MotionButton>
Expand Down Expand Up @@ -171,6 +176,9 @@ export default function DocumentBar() {
opacity: 1,
transform: 'translateX(0%)',
} }
transition={
isReducedMotion ? { duration: 0 } : undefined
}
>
<BlockIcon icon={ isTemplate ? templateIcon : icon } />
<Text
Expand Down