From f6d50ac817c02f3bed395215e906d980183717e1 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Wed, 18 Oct 2023 08:03:28 -0500 Subject: [PATCH] Added the document.addEventListener body click back in Authored by Luis Herranz . I'm just re-applying the change. --- packages/block-library/src/navigation/view.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-library/src/navigation/view.js b/packages/block-library/src/navigation/view.js index 4372bbb866109..bad36f6240134 100644 --- a/packages/block-library/src/navigation/view.js +++ b/packages/block-library/src/navigation/view.js @@ -13,6 +13,11 @@ const focusableSelectors = [ '[tabindex]:not([tabindex^="-"])', ]; +// This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out +// when the user taps in the body. It can be removed once we add an overlay to +// capture the clicks, instead of relying on the focusout event. +document.addEventListener( 'click', () => {} ); + const openMenu = ( store, menuOpenedOn ) => { const { context, selectors } = store; selectors.core.navigation.menuOpenedBy( store )[ menuOpenedOn ] = true;