Skip to content

Commit

Permalink
Use layout effect when triggering animation
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed May 7, 2024
1 parent bd386d7 commit 791211f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useContext,
useState,
useRef,
useEffect,
useLayoutEffect,
} from '@wordpress/element';
import { focus } from '@wordpress/dom';

Expand Down Expand Up @@ -60,7 +60,7 @@ function SidebarContentWrapper( { children } ) {
const wrapperRef = useRef();
const [ navAnimation, setNavAnimation ] = useState( null );

useEffect( () => {
useLayoutEffect( () => {
const { direction, focusSelector } = navState.get();
focusSidebarElement( wrapperRef.current, direction, focusSelector );
setNavAnimation( direction );
Expand Down

0 comments on commit 791211f

Please sign in to comment.