Skip to content

Commit

Permalink
Fix check for selectedBlockToolsRef
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Oct 13, 2023
1 parent 9cc91d9 commit 3a96e02
Showing 1 changed file with 1 addition and 1 deletion.
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 @@ -137,7 +137,7 @@ export default function BlockTools( {
insertBeforeBlock( clientIds[ 0 ] );
}
} else if ( isMatch( 'core/block-editor/unselect', event ) ) {
if ( selectedBlockToolsRef.current.contains( event.target ) ) {
if ( selectedBlockToolsRef?.current?.contains( event.target ) ) {
// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:
// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar
// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.
Expand Down

0 comments on commit 3a96e02

Please sign in to comment.