@react-aria/interactions 3.14.0 → 3.15.1
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 +9 -3
- package/dist/main.js +9 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +9 -3
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/useFocus.ts +11 -9
- package/src/useFocusVisible.ts +2 -1
- package/src/useFocusWithin.ts +3 -1
- package/src/utils.ts +7 -7
package/dist/module.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect, isMac as $bx7SL$isMac, useEvent as $bx7SL$useEvent, useDescription as $bx7SL$useDescription} from "@react-aria/utils";
|
|
2
2
|
import $bx7SL$react, {useRef as $bx7SL$useRef, useContext as $bx7SL$useContext, useState as $bx7SL$useState, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback} from "react";
|
|
3
|
+
import {useIsSSR as $bx7SL$useIsSSR} from "@react-aria/ssr";
|
|
3
4
|
|
|
4
5
|
/*
|
|
5
6
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -770,7 +771,9 @@ function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
|
|
770
771
|
]);
|
|
771
772
|
const onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
|
772
773
|
const onFocus = (0, $bx7SL$useCallback)((e)=>{
|
|
773
|
-
|
|
774
|
+
// Double check that document.activeElement actually matches e.target in case a previously chained
|
|
775
|
+
// focus handler already moved focus somewhere else.
|
|
776
|
+
if (e.target === e.currentTarget && document.activeElement === e.target) {
|
|
774
777
|
if (onFocusProp) onFocusProp(e);
|
|
775
778
|
if (onFocusChange) onFocusChange(true);
|
|
776
779
|
onSyntheticFocus(e);
|
|
@@ -805,6 +808,7 @@ function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
|
|
805
808
|
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
|
806
809
|
|
|
807
810
|
|
|
811
|
+
|
|
808
812
|
let $507fabe10e71c6fb$var$currentModality = null;
|
|
809
813
|
let $507fabe10e71c6fb$var$changeHandlers = new Set();
|
|
810
814
|
let $507fabe10e71c6fb$var$hasSetupGlobalListeners = false;
|
|
@@ -921,7 +925,7 @@ function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
|
|
|
921
925
|
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
|
922
926
|
};
|
|
923
927
|
}, []);
|
|
924
|
-
return modality;
|
|
928
|
+
return (0, $bx7SL$useIsSSR)() ? null : modality;
|
|
925
929
|
}
|
|
926
930
|
/**
|
|
927
931
|
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
|
|
@@ -996,7 +1000,9 @@ function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
|
|
996
1000
|
]);
|
|
997
1001
|
let onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
|
998
1002
|
let onFocus = (0, $bx7SL$useCallback)((e)=>{
|
|
999
|
-
|
|
1003
|
+
// Double check that document.activeElement actually matches e.target in case a previously chained
|
|
1004
|
+
// focus handler already moved focus somewhere else.
|
|
1005
|
+
if (!state.current.isFocusWithin && document.activeElement === e.target) {
|
|
1000
1006
|
if (onFocusWithin) onFocusWithin(e);
|
|
1001
1007
|
if (onFocusWithinChange) onFocusWithinChange(true);
|
|
1002
1008
|
state.current.isFocusWithin = true;
|