downshift 8.4.0 → 8.5.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.
@@ -1823,17 +1823,15 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1823
1823
  }
1824
1824
  return offset < 0 ? items.length - 1 : 0;
1825
1825
  }
1826
-
1827
1826
  /**
1828
- * Reuse the movement tracking of mouse and touch events.
1827
+ * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
1829
1828
  *
1830
- * @param {boolean} isOpen Whether the dropdown is open or not.
1831
- * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
1832
- * @param {Object} environment Environment where component/hook exists.
1833
- * @param {Function} handleBlur Handler on blur from mouse or touch.
1834
- * @returns {Object} Ref containing whether mouseDown or touchMove event is happening
1829
+ * @param {Object} environment The environment to add the event listeners to, for instance window.
1830
+ * @param {Array<HTMLElement>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
1831
+ * @param {Function} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
1832
+ * @returns {Object} The mouse and touch events information, if any of are happening.
1835
1833
  */
1836
- function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
1834
+ function useMouseAndTouchTracker(environment, downshiftElementRefs, handleBlur) {
1837
1835
  var mouseAndTouchTrackersRef = React.useRef({
1838
1836
  isMouseDown: false,
1839
1837
  isTouchMove: false,
@@ -1841,45 +1839,39 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
1841
1839
  });
1842
1840
  React.useEffect(function () {
1843
1841
  if (!environment) {
1844
- return;
1842
+ return noop;
1845
1843
  }
1846
-
1847
- // The same strategy for checking if a click occurred inside or outside downshift
1848
- // as in downshift.js.
1849
- var onMouseDown = function onMouseDown() {
1844
+ var downshiftElements = downshiftElementRefs.map(function (ref) {
1845
+ return ref.current;
1846
+ });
1847
+ function onMouseDown() {
1850
1848
  mouseAndTouchTrackersRef.current.isTouchEnd = false; // reset this one.
1851
1849
  mouseAndTouchTrackersRef.current.isMouseDown = true;
1852
- };
1853
- var onMouseUp = function onMouseUp(event) {
1850
+ }
1851
+ function onMouseUp(event) {
1854
1852
  mouseAndTouchTrackersRef.current.isMouseDown = false;
1855
- if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
1856
- return ref.current;
1857
- }), environment)) {
1853
+ if (!targetWithinDownshift(event.target, downshiftElements, environment)) {
1858
1854
  handleBlur();
1859
1855
  }
1860
- };
1861
- var onTouchStart = function onTouchStart() {
1856
+ }
1857
+ function onTouchStart() {
1862
1858
  mouseAndTouchTrackersRef.current.isTouchEnd = false;
1863
1859
  mouseAndTouchTrackersRef.current.isTouchMove = false;
1864
- };
1865
- var onTouchMove = function onTouchMove() {
1860
+ }
1861
+ function onTouchMove() {
1866
1862
  mouseAndTouchTrackersRef.current.isTouchMove = true;
1867
- };
1868
- var onTouchEnd = function onTouchEnd(event) {
1863
+ }
1864
+ function onTouchEnd(event) {
1869
1865
  mouseAndTouchTrackersRef.current.isTouchEnd = true;
1870
- if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
1871
- return ref.current;
1872
- }), environment, false)) {
1866
+ if (!mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElements, environment, false)) {
1873
1867
  handleBlur();
1874
1868
  }
1875
- };
1869
+ }
1876
1870
  environment.addEventListener('mousedown', onMouseDown);
1877
1871
  environment.addEventListener('mouseup', onMouseUp);
1878
1872
  environment.addEventListener('touchstart', onTouchStart);
1879
1873
  environment.addEventListener('touchmove', onTouchMove);
1880
1874
  environment.addEventListener('touchend', onTouchEnd);
1881
-
1882
- // eslint-disable-next-line consistent-return
1883
1875
  return function cleanup() {
1884
1876
  environment.removeEventListener('mousedown', onMouseDown);
1885
1877
  environment.removeEventListener('mouseup', onMouseUp);
@@ -1887,9 +1879,9 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
1887
1879
  environment.removeEventListener('touchmove', onTouchMove);
1888
1880
  environment.removeEventListener('touchend', onTouchEnd);
1889
1881
  };
1890
- // eslint-disable-next-line react-hooks/exhaustive-deps
1891
- }, [isOpen, environment]);
1892
- return mouseAndTouchTrackersRef;
1882
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- refs don't change
1883
+ }, [environment, handleBlur]);
1884
+ return mouseAndTouchTrackersRef.current;
1893
1885
  }
1894
1886
 
1895
1887
  /* istanbul ignore next */
@@ -2482,12 +2474,13 @@ function useSelect(userProps) {
2482
2474
  }
2483
2475
  // eslint-disable-next-line react-hooks/exhaustive-deps
2484
2476
  }, []);
2485
- // Add mouse/touch events to document.
2486
- var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2487
- dispatch({
2488
- type: ToggleButtonBlur
2489
- });
2490
- });
2477
+ var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, [toggleButtonRef, menuRef], React.useCallback(function handleBlur() {
2478
+ if (latest.current.state.isOpen) {
2479
+ dispatch({
2480
+ type: ToggleButtonBlur
2481
+ });
2482
+ }
2483
+ }, [dispatch, latest]));
2491
2484
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
2492
2485
  // Reset itemRefs on close.
2493
2486
  React.useEffect(function () {
@@ -2673,7 +2666,7 @@ function useSelect(userProps) {
2673
2666
  });
2674
2667
  };
2675
2668
  var toggleButtonHandleBlur = function toggleButtonHandleBlur() {
2676
- if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
2669
+ if (latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {
2677
2670
  dispatch({
2678
2671
  type: ToggleButtonBlur
2679
2672
  });
@@ -2690,7 +2683,7 @@ function useSelect(userProps) {
2690
2683
  }
2691
2684
  setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
2692
2685
  return toggleProps;
2693
- }, [latest, elementIds, setGetterPropCallInfo, dispatch, mouseAndTouchTrackersRef, toggleButtonKeyDownHandlers]);
2686
+ }, [dispatch, elementIds, latest, mouseAndTouchTrackers, setGetterPropCallInfo, toggleButtonKeyDownHandlers]);
2694
2687
  var getItemProps = React.useCallback(function (_temp6) {
2695
2688
  var _extends4;
2696
2689
  var _ref6 = _temp6 === void 0 ? {} : _temp6,
@@ -2716,7 +2709,7 @@ function useSelect(userProps) {
2716
2709
  index = _getItemAndIndex[1];
2717
2710
  var disabled = latestProps.isItemDisabled(item, index);
2718
2711
  var itemHandleMouseMove = function itemHandleMouseMove() {
2719
- if (mouseAndTouchTrackersRef.current.isTouchEnd || index === latestState.highlightedIndex) {
2712
+ if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {
2720
2713
  return;
2721
2714
  }
2722
2715
  shouldScrollRef.current = false;
@@ -2750,7 +2743,7 @@ function useSelect(userProps) {
2750
2743
  itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
2751
2744
  itemProps.onMouseDown = callAllEventHandlers(onMouseDown, itemHandleMouseDown);
2752
2745
  return itemProps;
2753
- }, [latest, elementIds, mouseAndTouchTrackersRef, shouldScrollRef, dispatch]);
2746
+ }, [latest, elementIds, mouseAndTouchTrackers, shouldScrollRef, dispatch]);
2754
2747
  return {
2755
2748
  // prop getters.
2756
2749
  getToggleButtonProps: getToggleButtonProps,
@@ -3111,13 +3104,14 @@ function useCombobox(userProps) {
3111
3104
  previousResultCountRef.current = items.length;
3112
3105
  }
3113
3106
  });
3114
- // Add mouse/touch events to document.
3115
- var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [inputRef, menuRef, toggleButtonRef], environment, function () {
3116
- dispatch({
3117
- type: InputBlur,
3118
- selectItem: false
3119
- });
3120
- });
3107
+ var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, [toggleButtonRef, menuRef, inputRef], React.useCallback(function handleBlur() {
3108
+ if (latest.current.state.isOpen) {
3109
+ dispatch({
3110
+ type: InputBlur,
3111
+ selectItem: false
3112
+ });
3113
+ }
3114
+ }, [dispatch, latest]));
3121
3115
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
3122
3116
  // Reset itemRefs on close.
3123
3117
  React.useEffect(function () {
@@ -3265,7 +3259,7 @@ function useCombobox(userProps) {
3265
3259
  var onSelectKey = /* istanbul ignore next (react-native) */'onPress' ;
3266
3260
  var customClickHandler = onClick;
3267
3261
  var itemHandleMouseMove = function itemHandleMouseMove() {
3268
- if (mouseAndTouchTrackersRef.current.isTouchEnd || index === latestState.highlightedIndex) {
3262
+ if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {
3269
3263
  return;
3270
3264
  }
3271
3265
  shouldScrollRef.current = false;
@@ -3293,7 +3287,7 @@ function useCombobox(userProps) {
3293
3287
  onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
3294
3288
  onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)
3295
3289
  }, rest);
3296
- }, [dispatch, elementIds, latest, mouseAndTouchTrackersRef, shouldScrollRef]);
3290
+ }, [dispatch, elementIds, latest, mouseAndTouchTrackers, shouldScrollRef]);
3297
3291
  var getToggleButtonProps = React.useCallback(function (_temp4) {
3298
3292
  var _extends4;
3299
3293
  var _ref5 = _temp4 === void 0 ? {} : _temp4;
@@ -3347,7 +3341,7 @@ function useCombobox(userProps) {
3347
3341
  };
3348
3342
  var inputHandleBlur = function inputHandleBlur(event) {
3349
3343
  /* istanbul ignore else */
3350
- if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
3344
+ if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {
3351
3345
  var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
3352
3346
  dispatch({
3353
3347
  type: InputBlur,
@@ -3371,7 +3365,7 @@ function useCombobox(userProps) {
3371
3365
  return _extends__default["default"]((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
3372
3366
  inputRef.current = inputNode;
3373
3367
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
3374
- }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
3368
+ }, [dispatch, elementIds, environment, inputKeyDownHandlers, latest, mouseAndTouchTrackers, setGetterPropCallInfo]);
3375
3369
 
3376
3370
  // returns
3377
3371
  var toggleMenu = React.useCallback(function () {
@@ -3181,17 +3181,15 @@
3181
3181
  }
3182
3182
  return offset < 0 ? items.length - 1 : 0;
3183
3183
  }
3184
-
3185
3184
  /**
3186
- * Reuse the movement tracking of mouse and touch events.
3185
+ * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
3187
3186
  *
3188
- * @param {boolean} isOpen Whether the dropdown is open or not.
3189
- * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
3190
- * @param {Object} environment Environment where component/hook exists.
3191
- * @param {Function} handleBlur Handler on blur from mouse or touch.
3192
- * @returns {Object} Ref containing whether mouseDown or touchMove event is happening
3187
+ * @param {Object} environment The environment to add the event listeners to, for instance window.
3188
+ * @param {Array<HTMLElement>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
3189
+ * @param {Function} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
3190
+ * @returns {Object} The mouse and touch events information, if any of are happening.
3193
3191
  */
3194
- function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
3192
+ function useMouseAndTouchTracker(environment, downshiftElementRefs, handleBlur) {
3195
3193
  var mouseAndTouchTrackersRef = React.useRef({
3196
3194
  isMouseDown: false,
3197
3195
  isTouchMove: false,
@@ -3199,45 +3197,39 @@
3199
3197
  });
3200
3198
  React.useEffect(function () {
3201
3199
  if (!environment) {
3202
- return;
3200
+ return noop;
3203
3201
  }
3204
-
3205
- // The same strategy for checking if a click occurred inside or outside downshift
3206
- // as in downshift.js.
3207
- var onMouseDown = function onMouseDown() {
3202
+ var downshiftElements = downshiftElementRefs.map(function (ref) {
3203
+ return ref.current;
3204
+ });
3205
+ function onMouseDown() {
3208
3206
  mouseAndTouchTrackersRef.current.isTouchEnd = false; // reset this one.
3209
3207
  mouseAndTouchTrackersRef.current.isMouseDown = true;
3210
- };
3211
- var onMouseUp = function onMouseUp(event) {
3208
+ }
3209
+ function onMouseUp(event) {
3212
3210
  mouseAndTouchTrackersRef.current.isMouseDown = false;
3213
- if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
3214
- return ref.current;
3215
- }), environment)) {
3211
+ if (!targetWithinDownshift(event.target, downshiftElements, environment)) {
3216
3212
  handleBlur();
3217
3213
  }
3218
- };
3219
- var onTouchStart = function onTouchStart() {
3214
+ }
3215
+ function onTouchStart() {
3220
3216
  mouseAndTouchTrackersRef.current.isTouchEnd = false;
3221
3217
  mouseAndTouchTrackersRef.current.isTouchMove = false;
3222
- };
3223
- var onTouchMove = function onTouchMove() {
3218
+ }
3219
+ function onTouchMove() {
3224
3220
  mouseAndTouchTrackersRef.current.isTouchMove = true;
3225
- };
3226
- var onTouchEnd = function onTouchEnd(event) {
3221
+ }
3222
+ function onTouchEnd(event) {
3227
3223
  mouseAndTouchTrackersRef.current.isTouchEnd = true;
3228
- if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
3229
- return ref.current;
3230
- }), environment, false)) {
3224
+ if (!mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElements, environment, false)) {
3231
3225
  handleBlur();
3232
3226
  }
3233
- };
3227
+ }
3234
3228
  environment.addEventListener('mousedown', onMouseDown);
3235
3229
  environment.addEventListener('mouseup', onMouseUp);
3236
3230
  environment.addEventListener('touchstart', onTouchStart);
3237
3231
  environment.addEventListener('touchmove', onTouchMove);
3238
3232
  environment.addEventListener('touchend', onTouchEnd);
3239
-
3240
- // eslint-disable-next-line consistent-return
3241
3233
  return function cleanup() {
3242
3234
  environment.removeEventListener('mousedown', onMouseDown);
3243
3235
  environment.removeEventListener('mouseup', onMouseUp);
@@ -3245,9 +3237,9 @@
3245
3237
  environment.removeEventListener('touchmove', onTouchMove);
3246
3238
  environment.removeEventListener('touchend', onTouchEnd);
3247
3239
  };
3248
- // eslint-disable-next-line react-hooks/exhaustive-deps
3249
- }, [isOpen, environment]);
3250
- return mouseAndTouchTrackersRef;
3240
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- refs don't change
3241
+ }, [environment, handleBlur]);
3242
+ return mouseAndTouchTrackersRef.current;
3251
3243
  }
3252
3244
 
3253
3245
  /* istanbul ignore next */
@@ -3871,12 +3863,13 @@
3871
3863
  }
3872
3864
  // eslint-disable-next-line react-hooks/exhaustive-deps
3873
3865
  }, []);
3874
- // Add mouse/touch events to document.
3875
- var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
3876
- dispatch({
3877
- type: ToggleButtonBlur
3878
- });
3879
- });
3866
+ var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, [toggleButtonRef, menuRef], React.useCallback(function handleBlur() {
3867
+ if (latest.current.state.isOpen) {
3868
+ dispatch({
3869
+ type: ToggleButtonBlur
3870
+ });
3871
+ }
3872
+ }, [dispatch, latest]));
3880
3873
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
3881
3874
  // Reset itemRefs on close.
3882
3875
  React.useEffect(function () {
@@ -4062,7 +4055,7 @@
4062
4055
  });
4063
4056
  };
4064
4057
  var toggleButtonHandleBlur = function toggleButtonHandleBlur() {
4065
- if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
4058
+ if (latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {
4066
4059
  dispatch({
4067
4060
  type: ToggleButtonBlur
4068
4061
  });
@@ -4091,7 +4084,7 @@
4091
4084
  }
4092
4085
  setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
4093
4086
  return toggleProps;
4094
- }, [latest, elementIds, setGetterPropCallInfo, dispatch, mouseAndTouchTrackersRef, toggleButtonKeyDownHandlers]);
4087
+ }, [dispatch, elementIds, latest, mouseAndTouchTrackers, setGetterPropCallInfo, toggleButtonKeyDownHandlers]);
4095
4088
  var getItemProps = React.useCallback(function (_temp6) {
4096
4089
  var _extends4;
4097
4090
  var _ref6 = _temp6 === void 0 ? {} : _temp6,
@@ -4117,7 +4110,7 @@
4117
4110
  index = _getItemAndIndex[1];
4118
4111
  var disabled = latestProps.isItemDisabled(item, index);
4119
4112
  var itemHandleMouseMove = function itemHandleMouseMove() {
4120
- if (mouseAndTouchTrackersRef.current.isTouchEnd || index === latestState.highlightedIndex) {
4113
+ if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {
4121
4114
  return;
4122
4115
  }
4123
4116
  shouldScrollRef.current = false;
@@ -4151,7 +4144,7 @@
4151
4144
  itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
4152
4145
  itemProps.onMouseDown = callAllEventHandlers(onMouseDown, itemHandleMouseDown);
4153
4146
  return itemProps;
4154
- }, [latest, elementIds, mouseAndTouchTrackersRef, shouldScrollRef, dispatch]);
4147
+ }, [latest, elementIds, mouseAndTouchTrackers, shouldScrollRef, dispatch]);
4155
4148
  return {
4156
4149
  // prop getters.
4157
4150
  getToggleButtonProps: getToggleButtonProps,
@@ -4512,13 +4505,14 @@
4512
4505
  previousResultCountRef.current = items.length;
4513
4506
  }
4514
4507
  });
4515
- // Add mouse/touch events to document.
4516
- var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [inputRef, menuRef, toggleButtonRef], environment, function () {
4517
- dispatch({
4518
- type: InputBlur,
4519
- selectItem: false
4520
- });
4521
- });
4508
+ var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, [toggleButtonRef, menuRef, inputRef], React.useCallback(function handleBlur() {
4509
+ if (latest.current.state.isOpen) {
4510
+ dispatch({
4511
+ type: InputBlur,
4512
+ selectItem: false
4513
+ });
4514
+ }
4515
+ }, [dispatch, latest]));
4522
4516
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
4523
4517
  // Reset itemRefs on close.
4524
4518
  React.useEffect(function () {
@@ -4666,7 +4660,7 @@
4666
4660
  var onSelectKey = 'onClick';
4667
4661
  var customClickHandler = onClick;
4668
4662
  var itemHandleMouseMove = function itemHandleMouseMove() {
4669
- if (mouseAndTouchTrackersRef.current.isTouchEnd || index === latestState.highlightedIndex) {
4663
+ if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {
4670
4664
  return;
4671
4665
  }
4672
4666
  shouldScrollRef.current = false;
@@ -4694,7 +4688,7 @@
4694
4688
  onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
4695
4689
  onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)
4696
4690
  }, rest);
4697
- }, [dispatch, elementIds, latest, mouseAndTouchTrackersRef, shouldScrollRef]);
4691
+ }, [dispatch, elementIds, latest, mouseAndTouchTrackers, shouldScrollRef]);
4698
4692
  var getToggleButtonProps = React.useCallback(function (_temp4) {
4699
4693
  var _extends4;
4700
4694
  var _ref5 = _temp4 === void 0 ? {} : _temp4,
@@ -4748,7 +4742,7 @@
4748
4742
  };
4749
4743
  var inputHandleBlur = function inputHandleBlur(event) {
4750
4744
  /* istanbul ignore else */
4751
- if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
4745
+ if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {
4752
4746
  var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
4753
4747
  dispatch({
4754
4748
  type: InputBlur,
@@ -4772,7 +4766,7 @@
4772
4766
  return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
4773
4767
  inputRef.current = inputNode;
4774
4768
  }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
4775
- }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);
4769
+ }, [dispatch, elementIds, environment, inputKeyDownHandlers, latest, mouseAndTouchTrackers, setGetterPropCallInfo]);
4776
4770
 
4777
4771
  // returns
4778
4772
  var toggleMenu = React.useCallback(function () {