downshift 8.0.2 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "downshift",
3
- "version": "8.0.2",
3
+ "version": "8.1.0",
4
4
  "description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",
5
5
  "main": "dist/downshift.cjs.js",
6
6
  "react-native": "dist/downshift.native.cjs.js",
@@ -2380,6 +2380,14 @@ function useSelect(userProps) {
2380
2380
  }
2381
2381
  previousResultCountRef.current = items.length;
2382
2382
  });
2383
+ // Focus the toggle button on first render if required.
2384
+ React.useEffect(function () {
2385
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2386
+ if (focusOnOpen && toggleButtonRef.current) {
2387
+ toggleButtonRef.current.focus();
2388
+ }
2389
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2390
+ }, []);
2383
2391
  // Add mouse/touch events to document.
2384
2392
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2385
2393
  dispatch({
@@ -2366,6 +2366,14 @@ function useSelect(userProps) {
2366
2366
  }
2367
2367
  previousResultCountRef.current = items.length;
2368
2368
  });
2369
+ // Focus the toggle button on first render if required.
2370
+ useEffect(function () {
2371
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2372
+ if (focusOnOpen && toggleButtonRef.current) {
2373
+ toggleButtonRef.current.focus();
2374
+ }
2375
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2376
+ }, []);
2369
2377
  // Add mouse/touch events to document.
2370
2378
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2371
2379
  dispatch({
@@ -2681,6 +2681,14 @@
2681
2681
  }
2682
2682
  previousResultCountRef.current = items.length;
2683
2683
  });
2684
+ // Focus the toggle button on first render if required.
2685
+ React.useEffect(function () {
2686
+ var focusOnOpen = getInitialValue$1(props, 'isOpen');
2687
+ if (focusOnOpen && toggleButtonRef.current) {
2688
+ toggleButtonRef.current.focus();
2689
+ }
2690
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2691
+ }, []);
2684
2692
  // Add mouse/touch events to document.
2685
2693
  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
2686
2694
  dispatch({