Skip to content

Commit

Permalink
Checking for container in the utility method as well. Just in case...
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Dec 15, 2021
1 parent 9b0c546 commit f82e5b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/block-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ import { usePopoverScroll } from './use-popover-scroll';
* @return {boolean} Whether the container contains the currently active element in the document.
*/
const hasFocusWithin = ( container ) => {
return !! container?.contains( container?.ownerDocument?.activeElement );
return (
!! container &&
!! container?.contains( container?.ownerDocument?.activeElement )
);
};

/**
Expand Down

0 comments on commit f82e5b9

Please sign in to comment.