Skip to content

Commit

Permalink
[mini] drag and drop: fix scroll disorientation after drop (#67405)
Browse files Browse the repository at this point in the history
Co-authored-by: ellatrix <[email protected]>
Co-authored-by: talldan <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2024
1 parent a6212c8 commit a572238
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 a572238

Please sign in to comment.