diff --git a/packages/block-editor/src/utils/get-editor-region.js b/packages/block-editor/src/utils/get-editor-region.js index 90bdf51c6a5341..7edc57d1157fb4 100644 --- a/packages/block-editor/src/utils/get-editor-region.js +++ b/packages/block-editor/src/utils/get-editor-region.js @@ -2,7 +2,7 @@ * Gets the editor region for a given editor canvas element or * returns the passed element if no region is found * - * @param { Object } editor + * @param { Object } editor The editor canvas element. * @return { Object } The editor region or given editor element */ export default function getEditorRegion( editor ) { @@ -13,16 +13,15 @@ export default function getEditorRegion( editor ) { // If there are multiple editors, we need to find the iframe that contains our contentRef to make sure // we're focusing the region that contains this editor. const editorCanvas = - document - .querySelectorAll( 'iframe[name="editor-canvas"]' ) - .values() - .find( ( iframe ) => { - // Find the iframe that contains our contentRef - const iframeDocument = - iframe.contentDocument || iframe.contentWindow.document; + Array.from( + document.querySelectorAll( 'iframe[name="editor-canvas"]' ).values() + ).find( ( iframe ) => { + // Find the iframe that contains our contentRef + const iframeDocument = + iframe.contentDocument || iframe.contentWindow.document; - return iframeDocument === editor.ownerDocument; - } ) ?? editor; + return iframeDocument === editor.ownerDocument; + } ) ?? editor; // The region is provivided by the editor, not the block-editor. // We should send focus to the region if one is available to reuse the