diff --git a/packages/block-editor/src/components/inner-blocks/index.js b/packages/block-editor/src/components/inner-blocks/index.js index 0d35b459190fe..1e057ccc048d1 100644 --- a/packages/block-editor/src/components/inner-blocks/index.js +++ b/packages/block-editor/src/components/inner-blocks/index.js @@ -205,10 +205,17 @@ export function useInnerBlocksProps( props = {}, options = {} ) { isDragging, getSectionRootClientId, } = unlock( select( blockEditorStore ) ); - let _isDropZoneDisabled; if ( ! clientId ) { - return { isDropZoneDisabled: _isDropZoneDisabled }; + const sectionRootClientId = getSectionRootClientId(); + // Disable the root drop zone when zoomed out and the section root client id + // is not the root block list (represented by an empty string). + // This avoids drag handling bugs caused by having two block lists acting as + // drop zones - the actual 'root' block list and the section root. + return { + isDropZoneDisabled: + isZoomOut() && sectionRootClientId !== '', + }; } const { hasBlockSupport, getBlockType } = select( blocksStore ); @@ -219,14 +226,13 @@ export function useInnerBlocksProps( props = {}, options = {} ) { const parentClientId = getBlockRootClientId( clientId ); const [ defaultLayout ] = getBlockSettings( clientId, 'layout' ); - _isDropZoneDisabled = blockEditingMode === 'disabled'; + let _isDropZoneDisabled = blockEditingMode === 'disabled'; if ( __unstableGetEditorMode() === 'zoom-out' ) { // In zoom out mode, we want to disable the drop zone for the sections. // The inner blocks belonging to the section drop zone is // already disabled by the blocks themselves being disabled. const sectionRootClientId = getSectionRootClientId(); - _isDropZoneDisabled = clientId !== sectionRootClientId; } diff --git a/packages/block-editor/src/components/use-block-drop-zone/index.js b/packages/block-editor/src/components/use-block-drop-zone/index.js index ff4d52aaa493b..d73c7f3faea12 100644 --- a/packages/block-editor/src/components/use-block-drop-zone/index.js +++ b/packages/block-editor/src/components/use-block-drop-zone/index.js @@ -287,7 +287,7 @@ function isInsertionPoint( targetToCheck, ownerDocument ) { return !! ( defaultView && targetToCheck instanceof defaultView.HTMLElement && - targetToCheck.dataset.isInsertionPoint + targetToCheck.closest( '[data-is-insertion-point]' ) ); }