@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 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
- if (e.target === e.currentTarget) {
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
- if (!state.current.isFocusWithin) {
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;
package/dist/main.js CHANGED
@@ -1,5 +1,6 @@
1
1
  var $goTMa$reactariautils = require("@react-aria/utils");
2
2
  var $goTMa$react = require("react");
3
+ var $goTMa$reactariassr = require("@react-aria/ssr");
3
4
 
4
5
  function $parcel$export(e, n, v, s) {
5
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
@@ -794,7 +795,9 @@ function $5cb73d0ce355b0dc$export$f8168d8dd8fd66e6(props) {
794
795
  ]);
795
796
  const onSyntheticFocus = (0, $625cf83917e112ad$export$715c682d09d639cc)(onBlur);
796
797
  const onFocus = (0, $goTMa$react.useCallback)((e)=>{
797
- if (e.target === e.currentTarget) {
798
+ // Double check that document.activeElement actually matches e.target in case a previously chained
799
+ // focus handler already moved focus somewhere else.
800
+ if (e.target === e.currentTarget && document.activeElement === e.target) {
798
801
  if (onFocusProp) onFocusProp(e);
799
802
  if (onFocusChange) onFocusChange(true);
800
803
  onSyntheticFocus(e);
@@ -829,6 +832,7 @@ function $5cb73d0ce355b0dc$export$f8168d8dd8fd66e6(props) {
829
832
  // See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
830
833
 
831
834
 
835
+
832
836
  let $e77252a287ef94ab$var$currentModality = null;
833
837
  let $e77252a287ef94ab$var$changeHandlers = new Set();
834
838
  let $e77252a287ef94ab$var$hasSetupGlobalListeners = false;
@@ -945,7 +949,7 @@ function $e77252a287ef94ab$export$98e20ec92f614cfe() {
945
949
  $e77252a287ef94ab$var$changeHandlers.delete(handler);
946
950
  };
947
951
  }, []);
948
- return modality;
952
+ return (0, $goTMa$reactariassr.useIsSSR)() ? null : modality;
949
953
  }
950
954
  /**
951
955
  * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
@@ -1020,7 +1024,9 @@ function $d16842bbd0359d1b$export$420e68273165f4ec(props) {
1020
1024
  ]);
1021
1025
  let onSyntheticFocus = (0, $625cf83917e112ad$export$715c682d09d639cc)(onBlur);
1022
1026
  let onFocus = (0, $goTMa$react.useCallback)((e)=>{
1023
- if (!state.current.isFocusWithin) {
1027
+ // Double check that document.activeElement actually matches e.target in case a previously chained
1028
+ // focus handler already moved focus somewhere else.
1029
+ if (!state.current.isFocusWithin && document.activeElement === e.target) {
1024
1030
  if (onFocusWithin) onFocusWithin(e);
1025
1031
  if (onFocusWithinChange) onFocusWithinChange(true);
1026
1032
  state.current.isFocusWithin = true;