From b95d7efab0a600c12a79db7cd98e9a961d546da9 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 10 Oct 2024 15:42:35 +0100 Subject: [PATCH] Fix bug with Posts with no full width blocks --- .../src/components/block-popover/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/block-popover/index.js b/packages/block-editor/src/components/block-popover/index.js index d51ad046e395f5..e41bb239798263 100644 --- a/packages/block-editor/src/components/block-popover/index.js +++ b/packages/block-editor/src/components/block-popover/index.js @@ -132,13 +132,14 @@ function BlockPopover( // not full width and nested blocks to keep section height. if ( isZoomOut && isSectionSelected ) { // If the rootSectionElement is undefined then recurse up the DOM tree - // to find the element with `is-root-container` classname. + // to find the element with `block-editor-iframe__body` classname. // This can then be used as the anchor point. // FIXME: we should not rely on classnames to find the // root section element if ( ! rootSectionElement ) { - postRootElement = - selectedElement.closest( '.is-root-container' ); + postRootElement = selectedElement.closest( + '.block-editor-iframe__body' + ); } // Compute the height based on the parent section of the @@ -176,11 +177,14 @@ function BlockPopover( contextElement: selectedElement, }; }, [ - bottomClientId, - lastSelectedElement, - selectedElement, popoverDimensionsRecomputeCounter, isZoomOut, + parentSectionElement, + selectedElement, + bottomClientId, + lastSelectedElement, + isSectionSelected, + rootSectionElement, ] ); if ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {