Skip to content

Commit

Permalink
conditionally call focus, as getEditorRegion could return null
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Jun 28, 2024
1 parent 2139bc2 commit 5f081dd
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 5f081dd

Please sign in to comment.