From a4bc8ae4c1db471bb34d908dd890a09d4c774303 Mon Sep 17 00:00:00 2001 From: BIKI DAS Date: Sat, 2 Oct 2021 19:56:15 +0530 Subject: [PATCH] Reopen #22481 Fixed modal closing issue (#22484) Co-authored-by: Brian Vaughn --- packages/react-devtools-shared/src/devtools/views/hooks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-devtools-shared/src/devtools/views/hooks.js b/packages/react-devtools-shared/src/devtools/views/hooks.js index 247a865060cd5..76dad56774540 100644 --- a/packages/react-devtools-shared/src/devtools/views/hooks.js +++ b/packages/react-devtools-shared/src/devtools/views/hooks.js @@ -239,7 +239,7 @@ export function useModalDismissSignal( ownerDocument = ((modalRef.current: any): HTMLDivElement).ownerDocument; ownerDocument.addEventListener('keydown', handleDocumentKeyDown); if (dismissOnClickOutside) { - ownerDocument.addEventListener('click', handleDocumentClick); + ownerDocument.addEventListener('click', handleDocumentClick, true); } }, 0); @@ -250,7 +250,7 @@ export function useModalDismissSignal( if (ownerDocument !== null) { ownerDocument.removeEventListener('keydown', handleDocumentKeyDown); - ownerDocument.removeEventListener('click', handleDocumentClick); + ownerDocument.removeEventListener('click', handleDocumentClick, true); } }; }, [modalRef, dismissCallback, dismissOnClickOutside]);