downshift 9.0.2 → 9.0.4

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": "9.0.2",
3
+ "version": "9.0.4",
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",
@@ -1780,10 +1780,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1780
1780
  return itemToKey(selectedItem) === itemToKey(item);
1781
1781
  });
1782
1782
  }
1783
- if (offset === 0) {
1784
- return -1;
1783
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
1784
+ return items.length - 1;
1785
+ }
1786
+ if (offset > 0 && !isItemDisabled(items[0])) {
1787
+ return 0;
1785
1788
  }
1786
- return offset < 0 ? items.length - 1 : 0;
1789
+ return -1;
1787
1790
  }
1788
1791
  /**
1789
1792
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
@@ -1768,10 +1768,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1768
1768
  return itemToKey(selectedItem) === itemToKey(item);
1769
1769
  });
1770
1770
  }
1771
- if (offset === 0) {
1772
- return -1;
1771
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
1772
+ return items.length - 1;
1773
+ }
1774
+ if (offset > 0 && !isItemDisabled(items[0])) {
1775
+ return 0;
1773
1776
  }
1774
- return offset < 0 ? items.length - 1 : 0;
1777
+ return -1;
1775
1778
  }
1776
1779
  /**
1777
1780
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
@@ -2044,10 +2044,13 @@
2044
2044
  return itemToKey(selectedItem) === itemToKey(item);
2045
2045
  });
2046
2046
  }
2047
- if (offset === 0) {
2048
- return -1;
2047
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
2048
+ return items.length - 1;
2049
+ }
2050
+ if (offset > 0 && !isItemDisabled(items[0])) {
2051
+ return 0;
2049
2052
  }
2050
- return offset < 0 ? items.length - 1 : 0;
2053
+ return -1;
2051
2054
  }
2052
2055
  /**
2053
2056
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.