Skip to content

Commit dc21804

Browse files
fix(@clayui/modal): stop closing the modal when the element is removed from the modal content
Verify that the element exists anywhere on the screen, covers the use case reported in #2165.
1 parent 691582c commit dc21804

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/clay-modal/src/Hook.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ const useUserInteractions = (
8282
if (
8383
elementRef.current &&
8484
event.target !== null &&
85-
!elementRef.current.contains(event.target as HTMLDivElement)
85+
!elementRef.current.contains(event.target as HTMLDivElement) &&
86+
document.contains(event.target as HTMLElement)
8687
) {
8788
onClick();
8889
}

0 commit comments

Comments
 (0)