@deque/cauldron-react 6.0.0-canary.51a804a1 → 6.0.0-canary.6de7685a
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/lib/index.js +10 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -3549,8 +3549,12 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3549
3549
|
}
|
|
3550
3550
|
}, [open]);
|
|
3551
3551
|
React.useEffect(function () {
|
|
3552
|
+
var _a = tslib.__read(Array.from(matchingOptions.entries()).find(function (_a) {
|
|
3553
|
+
var _b = tslib.__read(_a, 2), selected = _b[1].selected;
|
|
3554
|
+
return selected;
|
|
3555
|
+
}) || [], 2), element = _a[0], option = _a[1];
|
|
3552
3556
|
if (autocomplete === 'manual') {
|
|
3553
|
-
setActiveDescendant(null);
|
|
3557
|
+
setActiveDescendant(!element ? null : tslib.__assign({ element: element }, option));
|
|
3554
3558
|
}
|
|
3555
3559
|
else if (autocomplete === 'automatic' &&
|
|
3556
3560
|
matchingOptions.size &&
|
|
@@ -3609,8 +3613,11 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3609
3613
|
var enterKeypress = event.key === Enter;
|
|
3610
3614
|
var escKeypress = event.key === Escape;
|
|
3611
3615
|
var arrowKeypress = ['ArrowDown', 'ArrowUp'].includes(event.key);
|
|
3612
|
-
if (
|
|
3613
|
-
|
|
3616
|
+
if (
|
|
3617
|
+
// prevent the page from scrolling and allow start/end option activation
|
|
3618
|
+
[Home, End].includes(event.key) ||
|
|
3619
|
+
// prevent combobox from submitting any forms when the listbox is expanded
|
|
3620
|
+
(enterKeypress && open)) {
|
|
3614
3621
|
event.preventDefault();
|
|
3615
3622
|
}
|
|
3616
3623
|
if (escKeypress) {
|
package/package.json
CHANGED