power-focusable 4.0.0 → 4.0.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/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
var FOCUSABLE_SELECTOR = `:is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])`;
|
|
5
|
-
function createFocusTrap(container) {
|
|
5
|
+
function createFocusTrap(container = document.body) {
|
|
6
6
|
if (!(container instanceof Element)) {
|
|
7
7
|
throw new Error("Invalid container element");
|
|
8
8
|
}
|
|
@@ -398,7 +398,7 @@ function isUngroupedRadio(element) {
|
|
|
398
398
|
* Handles complex focus rules including tabindex ordering, radio groups, inert,
|
|
399
399
|
* and shadow DOM.
|
|
400
400
|
*
|
|
401
|
-
* @version 4.0.
|
|
401
|
+
* @version 4.0.2
|
|
402
402
|
* @author Yusuke Kamiyamane
|
|
403
403
|
* @license MIT
|
|
404
404
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles complex focus rules including tabindex ordering, radio groups, inert,
|
|
5
5
|
* and shadow DOM.
|
|
6
6
|
*
|
|
7
|
-
* @version 4.0.
|
|
7
|
+
* @version 4.0.2
|
|
8
8
|
* @author Yusuke Kamiyamane
|
|
9
9
|
* @license MIT
|
|
10
10
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -16,7 +16,7 @@ interface PowerFocusableOptions {
|
|
|
16
16
|
readonly filter?: (element: Element) => boolean;
|
|
17
17
|
readonly wrap?: boolean;
|
|
18
18
|
}
|
|
19
|
-
declare function createFocusTrap(container
|
|
19
|
+
declare function createFocusTrap(container?: Element): () => void;
|
|
20
20
|
declare function getFocusables(container?: Element, options?: Omit<PowerFocusableOptions, 'anchor' | 'wrap'>): Element[];
|
|
21
21
|
declare function getNextFocusable(container?: Element, options?: PowerFocusableOptions): Element | null;
|
|
22
22
|
declare function getPreviousFocusable(container?: Element, options?: PowerFocusableOptions): Element | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles complex focus rules including tabindex ordering, radio groups, inert,
|
|
5
5
|
* and shadow DOM.
|
|
6
6
|
*
|
|
7
|
-
* @version 4.0.
|
|
7
|
+
* @version 4.0.2
|
|
8
8
|
* @author Yusuke Kamiyamane
|
|
9
9
|
* @license MIT
|
|
10
10
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -16,7 +16,7 @@ interface PowerFocusableOptions {
|
|
|
16
16
|
readonly filter?: (element: Element) => boolean;
|
|
17
17
|
readonly wrap?: boolean;
|
|
18
18
|
}
|
|
19
|
-
declare function createFocusTrap(container
|
|
19
|
+
declare function createFocusTrap(container?: Element): () => void;
|
|
20
20
|
declare function getFocusables(container?: Element, options?: Omit<PowerFocusableOptions, 'anchor' | 'wrap'>): Element[];
|
|
21
21
|
declare function getNextFocusable(container?: Element, options?: PowerFocusableOptions): Element | null;
|
|
22
22
|
declare function getPreviousFocusable(container?: Element, options?: PowerFocusableOptions): Element | null;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var FOCUSABLE_SELECTOR = `:is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])`;
|
|
3
|
-
function createFocusTrap(container) {
|
|
3
|
+
function createFocusTrap(container = document.body) {
|
|
4
4
|
if (!(container instanceof Element)) {
|
|
5
5
|
throw new Error("Invalid container element");
|
|
6
6
|
}
|
|
@@ -396,7 +396,7 @@ function isUngroupedRadio(element) {
|
|
|
396
396
|
* Handles complex focus rules including tabindex ordering, radio groups, inert,
|
|
397
397
|
* and shadow DOM.
|
|
398
398
|
*
|
|
399
|
-
* @version 4.0.
|
|
399
|
+
* @version 4.0.2
|
|
400
400
|
* @author Yusuke Kamiyamane
|
|
401
401
|
* @license MIT
|
|
402
402
|
* @copyright Copyright (c) Yusuke Kamiyamane
|