downshift 8.0.1 → 8.1.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.
@@ -2419,6 +2419,14 @@ function useSelect(userProps) {
2419
2419
  }
2420
2420
  previousResultCountRef.current = items.length;
2421
2421
  });
2422
+ // Focus the toggle button on first render if required.
2423
+ React.useEffect(function () {
2424
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2425
+ if (focusOnOpen && toggleButtonRef.current) {
2426
+ toggleButtonRef.current.focus();
2427
+ }
2428
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2429
+ }, []);
2422
2430
  // Add mouse/touch events to document.
2423
2431
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2424
2432
  dispatch({
@@ -2405,6 +2405,14 @@ function useSelect(userProps) {
2405
2405
  }
2406
2406
  previousResultCountRef.current = items.length;
2407
2407
  });
2408
+ // Focus the toggle button on first render if required.
2409
+ useEffect(function () {
2410
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2411
+ if (focusOnOpen && toggleButtonRef.current) {
2412
+ toggleButtonRef.current.focus();
2413
+ }
2414
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2415
+ }, []);
2408
2416
  // Add mouse/touch events to document.
2409
2417
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2410
2418
  dispatch({
@@ -2354,6 +2354,14 @@ function useSelect(userProps) {
2354
2354
  }
2355
2355
  previousResultCountRef.current = items.length;
2356
2356
  });
2357
+ // Focus the toggle button on first render if required.
2358
+ React.useEffect(function () {
2359
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2360
+ if (focusOnOpen && toggleButtonRef.current) {
2361
+ toggleButtonRef.current.focus();
2362
+ }
2363
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2364
+ }, []);
2357
2365
  // Add mouse/touch events to document.
2358
2366
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2359
2367
  dispatch({
@@ -2414,6 +2414,14 @@ function useSelect(userProps) {
2414
2414
  }
2415
2415
  previousResultCountRef.current = items.length;
2416
2416
  });
2417
+ // Focus the toggle button on first render if required.
2418
+ React.useEffect(function () {
2419
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2420
+ if (focusOnOpen && toggleButtonRef.current) {
2421
+ toggleButtonRef.current.focus();
2422
+ }
2423
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2424
+ }, []);
2417
2425
  // Add mouse/touch events to document.
2418
2426
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2419
2427
  dispatch({
@@ -3739,6 +3739,14 @@
3739
3739
  }
3740
3740
  previousResultCountRef.current = items.length;
3741
3741
  });
3742
+ // Focus the toggle button on first render if required.
3743
+ React.useEffect(function () {
3744
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
3745
+ if (focusOnOpen && toggleButtonRef.current) {
3746
+ toggleButtonRef.current.focus();
3747
+ }
3748
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3749
+ }, []);
3742
3750
  // Add mouse/touch events to document.
3743
3751
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
3744
3752
  dispatch({