@react-aria/overlays 3.16.0 → 3.17.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/dist/import.mjs +10 -2
- package/dist/main.js +10 -2
- package/dist/main.js.map +1 -1
- package/dist/module.js +10 -2
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/calculatePosition.ts +3 -1
- package/src/useOverlay.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/overlays",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "^3.14.
|
|
26
|
-
"@react-aria/i18n": "^3.8.
|
|
27
|
-
"@react-aria/interactions": "^3.
|
|
28
|
-
"@react-aria/ssr": "^3.
|
|
29
|
-
"@react-aria/utils": "^3.
|
|
30
|
-
"@react-aria/visually-hidden": "^3.8.
|
|
31
|
-
"@react-stately/overlays": "^3.6.
|
|
32
|
-
"@react-types/button": "^3.
|
|
33
|
-
"@react-types/overlays": "^3.8.
|
|
34
|
-
"@react-types/shared": "^3.
|
|
25
|
+
"@react-aria/focus": "^3.14.1",
|
|
26
|
+
"@react-aria/i18n": "^3.8.2",
|
|
27
|
+
"@react-aria/interactions": "^3.18.0",
|
|
28
|
+
"@react-aria/ssr": "^3.8.0",
|
|
29
|
+
"@react-aria/utils": "^3.20.0",
|
|
30
|
+
"@react-aria/visually-hidden": "^3.8.4",
|
|
31
|
+
"@react-stately/overlays": "^3.6.2",
|
|
32
|
+
"@react-types/button": "^3.8.0",
|
|
33
|
+
"@react-types/overlays": "^3.8.2",
|
|
34
|
+
"@react-types/shared": "^3.20.0",
|
|
35
35
|
"@swc/helpers": "^0.5.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "54fbaa67cc56867506811819fef765546d403253"
|
|
45
45
|
}
|
package/src/calculatePosition.ts
CHANGED
|
@@ -143,7 +143,9 @@ function getDelta(
|
|
|
143
143
|
containerDimensions: Dimensions,
|
|
144
144
|
padding: number
|
|
145
145
|
) {
|
|
146
|
-
let
|
|
146
|
+
let root = document.scrollingElement || document.documentElement;
|
|
147
|
+
let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
|
|
148
|
+
let containerScroll = isScrollPrevented ? 0 : containerDimensions.scroll[axis];
|
|
147
149
|
let containerHeight = containerDimensions[AXIS_SIZE[axis]];
|
|
148
150
|
|
|
149
151
|
let startEdgeOffset = offset - padding - containerScroll;
|
package/src/useOverlay.ts
CHANGED
|
@@ -125,10 +125,16 @@ export function useOverlay(props: AriaOverlayProps, ref: RefObject<Element>): Ov
|
|
|
125
125
|
let {focusWithinProps} = useFocusWithin({
|
|
126
126
|
isDisabled: !shouldCloseOnBlur,
|
|
127
127
|
onBlurWithin: (e) => {
|
|
128
|
+
// Do not close if relatedTarget is null, which means focus is lost to the body.
|
|
129
|
+
// That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.
|
|
130
|
+
// Clicking on the body to close the overlay should already be handled by useInteractOutside.
|
|
131
|
+
// https://github.com/adobe/react-spectrum/issues/4130
|
|
132
|
+
// https://github.com/adobe/react-spectrum/issues/4922
|
|
133
|
+
//
|
|
128
134
|
// If focus is moving into a child focus scope (e.g. menu inside a dialog),
|
|
129
135
|
// do not close the outer overlay. At this point, the active scope should
|
|
130
136
|
// still be the outer overlay, since blur events run before focus.
|
|
131
|
-
if (e.relatedTarget
|
|
137
|
+
if (!e.relatedTarget || isElementInChildOfActiveScope(e.relatedTarget)) {
|
|
132
138
|
return;
|
|
133
139
|
}
|
|
134
140
|
|