@react-aria/overlays 3.18.0 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/useOverlay.ts CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  import {DOMAttributes} from '@react-types/shared';
14
14
  import {isElementInChildOfActiveScope} from '@react-aria/focus';
15
- import {RefObject, SyntheticEvent, useEffect} from 'react';
15
+ import {RefObject, useEffect} from 'react';
16
16
  import {useFocusWithin, useInteractOutside} from '@react-aria/interactions';
17
17
 
18
18
  export interface AriaOverlayProps {
@@ -91,7 +91,7 @@ export function useOverlay(props: AriaOverlayProps, ref: RefObject<Element>): Ov
91
91
  }
92
92
  };
93
93
 
94
- let onInteractOutsideStart = (e: SyntheticEvent<Element>) => {
94
+ let onInteractOutsideStart = (e: PointerEvent) => {
95
95
  if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {
96
96
  if (visibleOverlays[visibleOverlays.length - 1] === ref) {
97
97
  e.stopPropagation();
@@ -100,7 +100,7 @@ export function useOverlay(props: AriaOverlayProps, ref: RefObject<Element>): Ov
100
100
  }
101
101
  };
102
102
 
103
- let onInteractOutside = (e: SyntheticEvent<Element>) => {
103
+ let onInteractOutside = (e: PointerEvent) => {
104
104
  if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {
105
105
  if (visibleOverlays[visibleOverlays.length - 1] === ref) {
106
106
  e.stopPropagation();
@@ -120,7 +120,7 @@ export function useOverlay(props: AriaOverlayProps, ref: RefObject<Element>): Ov
120
120
  };
121
121
 
122
122
  // Handle clicking outside the overlay to close it
123
- useInteractOutside({ref, onInteractOutside: isDismissable ? onInteractOutside : null, onInteractOutsideStart});
123
+ useInteractOutside({ref, onInteractOutside: isDismissable && isOpen ? onInteractOutside : null, onInteractOutsideStart});
124
124
 
125
125
  let {focusWithinProps} = useFocusWithin({
126
126
  isDisabled: !shouldCloseOnBlur,