diff --git a/packages/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js b/packages/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js index c059ff5bc7f2d6..2c1c5e768953bd 100644 --- a/packages/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js +++ b/packages/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js @@ -92,8 +92,19 @@ export default function useBlockToolbarPopoverProps( { const view = contentElement?.ownerDocument?.defaultView; view?.addEventHandler?.( 'resize', updateProps ); + // Update the toolbar props on block resize. + let resizeObserver; + if ( view.ResizeObserver ) { + resizeObserver = new view.ResizeObserver( updateProps ); + resizeObserver.observe( selectedBlockElement ); + } + return () => { view?.removeEventHandler?.( 'resize', updateProps ); + + if ( resizeObserver ) { + resizeObserver.disconnect(); + } }; // The deps will update the toolbar props if: