Skip to content

Commit

Permalink
[mini] drag and drop: fix scroll disorientation after drop (WordPress…
Browse files Browse the repository at this point in the history
…#67405)

Co-authored-by: ellatrix <[email protected]>
Co-authored-by: talldan <[email protected]>
  • Loading branch information
3 people authored and im3dabasia committed Dec 4, 2024
1 parent ac85333 commit 0a88589
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
isFirstMultiSelectedBlock,
isBlockMultiSelected,
isAncestorMultiSelected,
isDraggingBlocks,
} = useSelect( blockEditorStore );

// Whenever the trigger changes, we need to take a snapshot of the current
Expand Down Expand Up @@ -85,6 +86,11 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
}
}

// Neither animate nor scroll.
if ( isDraggingBlocks() ) {
return;
}

// We disable the animation if the user has a preference for reduced
// motion, if the user is typing (insertion by Enter), or if the block
// count exceeds the threshold (insertion caused all the blocks that
Expand Down Expand Up @@ -153,6 +159,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
isFirstMultiSelectedBlock,
isBlockMultiSelected,
isAncestorMultiSelected,
isDraggingBlocks,
] );

return ref;
Expand Down

0 comments on commit 0a88589

Please sign in to comment.