Skip to content

Commit

Permalink
Check that modal exists before using contains
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Jun 28, 2023
1 parent 242a3ba commit 3f29f8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const closeMenu = ( { context, selectors }, menuClosedOn ) => {
// Check if the menu is still open or not.
if ( ! selectors.core.navigation.isMenuOpen( { context } ) ) {
if (
context.core.navigation.modal.contains(
context.core.navigation.modal?.contains(
window.document.activeElement
)
) {
Expand Down Expand Up @@ -155,7 +155,7 @@ store( {
// `window.document.activeElement` doesn't change
if (
context.core.navigation.isMenuOpen.click &&
! context.core.navigation.modal.contains(
! context.core.navigation.modal?.contains(
event.relatedTarget
) &&
event.target !== window.document.activeElement
Expand Down

0 comments on commit 3f29f8b

Please sign in to comment.