diff --git a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js index a60ca7f396774..569905fba11e9 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js @@ -70,6 +70,12 @@ function ZoomOutModeInserters() { > { + // Hotfix for wp/6.7 where focus is not transferred to the sidebar if the + // block library is already open. + const blockLibrary = document.querySelector( + '[aria-label="Block Library"]' + ); + setInserterIsOpened( { rootClientId: sectionRootClientId, insertionIndex: index + 1, @@ -79,6 +85,12 @@ function ZoomOutModeInserters() { showInsertionPoint( sectionRootClientId, index + 1, { operation: 'insert', } ); + + // If the block library was available before we opened it with `setInserterIsOpened`, we need to + // send focus to the block library. + if ( blockLibrary ) { + blockLibrary.focus(); + } } } />