downshift 6.1.2-alpha.0 → 6.1.2
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/dist/downshift.cjs.js +6 -6
- package/dist/downshift.esm.js +6 -6
- package/dist/downshift.native.cjs.js +6 -6
- package/dist/downshift.umd.js +6 -6
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/preact/dist/downshift.cjs.js +6 -6
- package/preact/dist/downshift.esm.js +6 -6
- package/preact/dist/downshift.umd.js +6 -6
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/dist/downshift.cjs.js
CHANGED
|
@@ -67,8 +67,8 @@ function scrollIntoView(node, menuNode) {
|
|
|
67
67
|
*/
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
function isOrContainsNode(parent, child
|
|
71
|
-
return parent === child || child instanceof
|
|
70
|
+
function isOrContainsNode(parent, child) {
|
|
71
|
+
return parent === child || child instanceof Node && parent.contains && parent.contains(child);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Simple debounce implementation. Will call the given
|
|
@@ -416,20 +416,20 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
|
|
|
416
416
|
*
|
|
417
417
|
* @param {EventTarget} target Target to check.
|
|
418
418
|
* @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
|
|
419
|
-
* @param {
|
|
419
|
+
* @param {Document} document The document.
|
|
420
420
|
* @param {boolean} checkActiveElement Whether to also check activeElement.
|
|
421
421
|
*
|
|
422
422
|
* @returns {boolean} Whether or not the target is within downshift elements.
|
|
423
423
|
*/
|
|
424
424
|
|
|
425
425
|
|
|
426
|
-
function targetWithinDownshift(target, downshiftElements,
|
|
426
|
+
function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
|
|
427
427
|
if (checkActiveElement === void 0) {
|
|
428
428
|
checkActiveElement = true;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
return downshiftElements.some(function (contextNode) {
|
|
432
|
-
return contextNode && (isOrContainsNode(contextNode, target
|
|
432
|
+
return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
|
|
433
433
|
});
|
|
434
434
|
} // eslint-disable-next-line import/no-mutable-exports
|
|
435
435
|
|
|
@@ -2017,7 +2017,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
|
|
|
2017
2017
|
|
|
2018
2018
|
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
|
|
2019
2019
|
return ref.current;
|
|
2020
|
-
}), environment)) {
|
|
2020
|
+
}), environment.document)) {
|
|
2021
2021
|
handleBlur();
|
|
2022
2022
|
}
|
|
2023
2023
|
};
|
package/dist/downshift.esm.js
CHANGED
|
@@ -54,8 +54,8 @@ function scrollIntoView(node, menuNode) {
|
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
function isOrContainsNode(parent, child
|
|
58
|
-
return parent === child || child instanceof
|
|
57
|
+
function isOrContainsNode(parent, child) {
|
|
58
|
+
return parent === child || child instanceof Node && parent.contains && parent.contains(child);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Simple debounce implementation. Will call the given
|
|
@@ -403,20 +403,20 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
|
|
|
403
403
|
*
|
|
404
404
|
* @param {EventTarget} target Target to check.
|
|
405
405
|
* @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
|
|
406
|
-
* @param {
|
|
406
|
+
* @param {Document} document The document.
|
|
407
407
|
* @param {boolean} checkActiveElement Whether to also check activeElement.
|
|
408
408
|
*
|
|
409
409
|
* @returns {boolean} Whether or not the target is within downshift elements.
|
|
410
410
|
*/
|
|
411
411
|
|
|
412
412
|
|
|
413
|
-
function targetWithinDownshift(target, downshiftElements,
|
|
413
|
+
function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
|
|
414
414
|
if (checkActiveElement === void 0) {
|
|
415
415
|
checkActiveElement = true;
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
return downshiftElements.some(function (contextNode) {
|
|
419
|
-
return contextNode && (isOrContainsNode(contextNode, target
|
|
419
|
+
return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
|
|
420
420
|
});
|
|
421
421
|
} // eslint-disable-next-line import/no-mutable-exports
|
|
422
422
|
|
|
@@ -2004,7 +2004,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
|
|
|
2004
2004
|
|
|
2005
2005
|
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
|
|
2006
2006
|
return ref.current;
|
|
2007
|
-
}), environment)) {
|
|
2007
|
+
}), environment.document)) {
|
|
2008
2008
|
handleBlur();
|
|
2009
2009
|
}
|
|
2010
2010
|
};
|
|
@@ -67,8 +67,8 @@ function scrollIntoView(node, menuNode) {
|
|
|
67
67
|
*/
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
function isOrContainsNode(parent, child
|
|
71
|
-
return parent === child || child instanceof
|
|
70
|
+
function isOrContainsNode(parent, child) {
|
|
71
|
+
return parent === child || child instanceof Node && parent.contains && parent.contains(child);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Simple debounce implementation. Will call the given
|
|
@@ -416,20 +416,20 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
|
|
|
416
416
|
*
|
|
417
417
|
* @param {EventTarget} target Target to check.
|
|
418
418
|
* @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
|
|
419
|
-
* @param {
|
|
419
|
+
* @param {Document} document The document.
|
|
420
420
|
* @param {boolean} checkActiveElement Whether to also check activeElement.
|
|
421
421
|
*
|
|
422
422
|
* @returns {boolean} Whether or not the target is within downshift elements.
|
|
423
423
|
*/
|
|
424
424
|
|
|
425
425
|
|
|
426
|
-
function targetWithinDownshift(target, downshiftElements,
|
|
426
|
+
function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
|
|
427
427
|
if (checkActiveElement === void 0) {
|
|
428
428
|
checkActiveElement = true;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
return downshiftElements.some(function (contextNode) {
|
|
432
|
-
return contextNode && (isOrContainsNode(contextNode, target
|
|
432
|
+
return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
|
|
433
433
|
});
|
|
434
434
|
} // eslint-disable-next-line import/no-mutable-exports
|
|
435
435
|
|
|
@@ -1946,7 +1946,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
|
|
|
1946
1946
|
|
|
1947
1947
|
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
|
|
1948
1948
|
return ref.current;
|
|
1949
|
-
}), environment)) {
|
|
1949
|
+
}), environment.document)) {
|
|
1950
1950
|
handleBlur();
|
|
1951
1951
|
}
|
|
1952
1952
|
};
|
package/dist/downshift.umd.js
CHANGED
|
@@ -1517,8 +1517,8 @@
|
|
|
1517
1517
|
*/
|
|
1518
1518
|
|
|
1519
1519
|
|
|
1520
|
-
function isOrContainsNode(parent, child
|
|
1521
|
-
return parent === child || child instanceof
|
|
1520
|
+
function isOrContainsNode(parent, child) {
|
|
1521
|
+
return parent === child || child instanceof Node && parent.contains && parent.contains(child);
|
|
1522
1522
|
}
|
|
1523
1523
|
/**
|
|
1524
1524
|
* Simple debounce implementation. Will call the given
|
|
@@ -1866,20 +1866,20 @@
|
|
|
1866
1866
|
*
|
|
1867
1867
|
* @param {EventTarget} target Target to check.
|
|
1868
1868
|
* @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
|
|
1869
|
-
* @param {
|
|
1869
|
+
* @param {Document} document The document.
|
|
1870
1870
|
* @param {boolean} checkActiveElement Whether to also check activeElement.
|
|
1871
1871
|
*
|
|
1872
1872
|
* @returns {boolean} Whether or not the target is within downshift elements.
|
|
1873
1873
|
*/
|
|
1874
1874
|
|
|
1875
1875
|
|
|
1876
|
-
function targetWithinDownshift(target, downshiftElements,
|
|
1876
|
+
function targetWithinDownshift(target, downshiftElements, document, checkActiveElement) {
|
|
1877
1877
|
if (checkActiveElement === void 0) {
|
|
1878
1878
|
checkActiveElement = true;
|
|
1879
1879
|
}
|
|
1880
1880
|
|
|
1881
1881
|
return downshiftElements.some(function (contextNode) {
|
|
1882
|
-
return contextNode && (isOrContainsNode(contextNode, target
|
|
1882
|
+
return contextNode && (isOrContainsNode(contextNode, target) || checkActiveElement && isOrContainsNode(contextNode, document.activeElement));
|
|
1883
1883
|
});
|
|
1884
1884
|
} // eslint-disable-next-line import/no-mutable-exports
|
|
1885
1885
|
|
|
@@ -3457,7 +3457,7 @@
|
|
|
3457
3457
|
|
|
3458
3458
|
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
|
|
3459
3459
|
return ref.current;
|
|
3460
|
-
}), environment)) {
|
|
3460
|
+
}), environment.document)) {
|
|
3461
3461
|
handleBlur();
|
|
3462
3462
|
}
|
|
3463
3463
|
};
|