From bdde553b1796c556b93d97da8ffb6a89e5d955ea Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:27:02 +1000 Subject: [PATCH] List View: Ensure onDrop does not fire if there is no target (#52959) --- .../src/components/list-view/use-list-view-drop-zone.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/list-view/use-list-view-drop-zone.js b/packages/block-editor/src/components/list-view/use-list-view-drop-zone.js index aa5bfe0299292..a1a369d3f9408 100644 --- a/packages/block-editor/src/components/list-view/use-list-view-drop-zone.js +++ b/packages/block-editor/src/components/list-view/use-list-view-drop-zone.js @@ -489,7 +489,11 @@ export default function useListViewDropZone( { dropZoneElement } ) { const ref = useDropZone( { dropZoneElement, - onDrop: onBlockDrop, + onDrop( event ) { + if ( target ) { + onBlockDrop( event ); + } + }, onDragLeave() { throttled.cancel(); setTarget( null );