diff --git a/packages/react/src/hooks/useOverlay.ts b/packages/react/src/hooks/useOverlay.ts index ec5460e2baa..4f4cedbdc42 100644 --- a/packages/react/src/hooks/useOverlay.ts +++ b/packages/react/src/hooks/useOverlay.ts @@ -84,9 +84,13 @@ export function useOverlay( }, []); const dismiss = useCallback(async (data?: any, role?: string) => { - overlayRef.current && (await overlayRef.current.dismiss(data, role)); - overlayRef.current = undefined; - containerElRef.current = undefined; + if (overlayRef.current) { + const didDismiss = await overlayRef.current.dismiss(data, role); + if (didDismiss) { + overlayRef.current = undefined; + containerElRef.current = undefined; + } + } }, []); return {