Skip to content

Commit

Permalink
Post title: fix autofocus when iframed (#51367)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and fullofcaffeine committed Jun 9, 2023
1 parent 5ae895d commit 18546a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/editor/src/components/post-title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18546a0

Please sign in to comment.