Skip to content

Commit

Permalink
Conditionally call focus when using getEditorRegion (WordPress#62980)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj authored Jun 28, 2024
1 parent ab116d8 commit 15da2aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function BlockBreadcrumb( { rootLabelText } ) {

clearSelectedBlock();

getEditorRegion( blockEditor ).focus();
getEditorRegion( blockEditor )?.focus();
} }
>
{ rootLabel }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/block-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default function BlockTools( {
) {
event.preventDefault();
clearSelectedBlock();
getEditorRegion( __unstableContentRef.current ).focus();
getEditorRegion( __unstableContentRef.current )?.focus();
}
} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {
// If focus is currently within a text field, such as a rich text block or other editable field,
Expand Down

0 comments on commit 15da2aa

Please sign in to comment.