fix: listed menu closing when clicking inside challenge modal (#1863)

This commit is contained in:
Aman Harwara
2022-10-23 21:46:23 +05:30
committed by GitHub
parent bda16b88c0
commit bb63cbe2d1

View File

@@ -28,8 +28,9 @@ export const usePopoverCloseOnClickOutside = ({
const isAnchorElement = anchorElement ? anchorElement === event.target || anchorElement.contains(target) : false
const closestPopoverId = target.closest('[data-popover]')?.getAttribute('data-popover')
const isDescendantOfChildPopover = closestPopoverId && childPopovers.has(closestPopoverId)
const isDescendantOfChallengeModal = !!target.closest('.challenge-modal')
if (!isDescendantOfMenu && !isAnchorElement && !isDescendantOfChildPopover) {
if (!isDescendantOfMenu && !isAnchorElement && !isDescendantOfChildPopover && !isDescendantOfChallengeModal) {
togglePopover()
}
}