From 35ab7cc5283eca4e75a5487213c7ff1f28984b68 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Fri, 16 Jun 2023 11:33:03 -0700 Subject: [PATCH 01/16] Fix modal closing when a contained iframe is focused Remove focus outside hook. --- packages/components/src/modal/index.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/components/src/modal/index.tsx b/packages/components/src/modal/index.tsx index 2746c40fcaab02..718ea31a4a206d 100644 --- a/packages/components/src/modal/index.tsx +++ b/packages/components/src/modal/index.tsx @@ -20,7 +20,6 @@ import { useInstanceId, useFocusReturn, useFocusOnMount, - __experimentalUseFocusOutside as useFocusOutside, useConstrainedTabbing, useMergeRefs, } from '@wordpress/compose'; @@ -91,7 +90,6 @@ function UnforwardedModal( ); const constrainedTabbingRef = useConstrainedTabbing(); const focusReturnRef = useFocusReturn(); - const focusOutsideProps = useFocusOutside( onRequestClose ); const contentRef = useRef< HTMLDivElement >( null ); const childrenContainerRef = useRef< HTMLDivElement >( null ); @@ -253,9 +251,6 @@ function UnforwardedModal( aria-labelledby={ contentLabel ? undefined : headingId } aria-describedby={ aria.describedby } tabIndex={ -1 } - { ...( shouldCloseOnClickOutside - ? focusOutsideProps - : {} ) } onKeyDown={ onKeyDown } >
Date: Tue, 25 Oct 2022 21:54:06 +0900 Subject: [PATCH 02/16] Test: add iframe to Modal component --- packages/components/src/modal/stories/index.story.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/components/src/modal/stories/index.story.tsx b/packages/components/src/modal/stories/index.story.tsx index 60a53947116fac..7979d0c0cbddc1 100644 --- a/packages/components/src/modal/stories/index.story.tsx +++ b/packages/components/src/modal/stories/index.story.tsx @@ -76,6 +76,13 @@ const Template: StoryFn< typeof Modal > = ( { onRequestClose, ...args } ) => { +