diff --git a/packages/editor/src/components/post-title/index.js b/packages/editor/src/components/post-title/index.js index 4803d89942b481..d7094b080de9d3 100644 --- a/packages/editor/src/components/post-title/index.js +++ b/packages/editor/src/components/post-title/index.js @@ -74,8 +74,10 @@ function PostTitle( _, forwardedRef ) { return; } + const { defaultView } = ref.current.ownerDocument; + const { name, parent } = defaultView; const ownerDocument = - ref.current.ownerDocument.defaultView.parent.document; + name === 'editor-canvas' ? parent.document : defaultView.document; const { activeElement, body } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should