From 442156c89ebd37539e63ef4cd6f56f57efc197a6 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Fri, 26 Jul 2024 08:19:08 +0100 Subject: [PATCH] Don't open the drop area unless the insertion point is visible --- packages/block-editor/src/components/block-list/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-editor/src/components/block-list/index.js b/packages/block-editor/src/components/block-list/index.js index 6249a8641a4c5e..ec85ad9c554748 100644 --- a/packages/block-editor/src/components/block-list/index.js +++ b/packages/block-editor/src/components/block-list/index.js @@ -228,12 +228,14 @@ function Items( { sectionRootClientId, sectionClientIds, blockInsertionPoint, + blockInsertionPointVisible, } = useSelect( ( select ) => { const { getSettings, __unstableGetEditorMode, getBlockInsertionPoint, getBlockOrder, + isBlockInsertionPointVisible, } = unlock( select( blockEditorStore ) ); if ( __unstableGetEditorMode() === 'zoom-out' ) { @@ -245,6 +247,7 @@ function Items( { sectionClientIds: sectionRootClientIds, blockOrder: getBlockOrder( root ), blockInsertionPoint: getBlockInsertionPoint(), + blockInsertionPointVisible: isBlockInsertionPointVisible(), }; } return {}; @@ -274,12 +277,14 @@ function Items( { if ( position === 'top' ) { isVisible = + blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[ blockInsertionPoint.index ]; } if ( position === 'bottom' ) { isVisible = + blockInsertionPointVisible && clientId === sectionClientIds[ blockInsertionPoint.index - 1 ]; }