power-focusable 4.3.19 → 4.3.20
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/README.md +3 -3
- package/dist/index.cjs +13 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
} from 'power-focusable';
|
|
25
25
|
|
|
26
26
|
// CDNs
|
|
27
|
-
import { ... } 'https://esm.sh/power-focusable@4.3.
|
|
27
|
+
import { ... } 'https://esm.sh/power-focusable@4.3.20';
|
|
28
28
|
// or
|
|
29
|
-
import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.
|
|
29
|
+
import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.20/+esm';
|
|
30
30
|
// or
|
|
31
|
-
import { ... } 'https://esm.unpkg.com/power-focusable@4.3.
|
|
31
|
+
import { ... } 'https://esm.unpkg.com/power-focusable@4.3.20';
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## 🪄 Options
|
package/dist/index.cjs
CHANGED
|
@@ -96,14 +96,14 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
96
96
|
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
97
97
|
skipVisibilityCheck = false;
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const elements = [];
|
|
100
100
|
if (composed || include) {
|
|
101
101
|
let traverse2 = function(node) {
|
|
102
102
|
if (isFocusable(node, {
|
|
103
103
|
skipNegativeTabIndexCheck,
|
|
104
104
|
skipVisibilityCheck
|
|
105
105
|
}) || include?.(node)) {
|
|
106
|
-
|
|
106
|
+
elements[elements.length] = node;
|
|
107
107
|
}
|
|
108
108
|
const children2 = composed ? getComposedChildren(node) : getChildren(node);
|
|
109
109
|
for (let i = 0, l = children2.length; i < l; i++) {
|
|
@@ -117,22 +117,21 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
117
117
|
child && traverse2(child);
|
|
118
118
|
}
|
|
119
119
|
} else {
|
|
120
|
-
const
|
|
120
|
+
const candidates = container.querySelectorAll(
|
|
121
121
|
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
122
122
|
);
|
|
123
|
-
for (let i = 0, l =
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
123
|
+
for (let i = 0, l = candidates.length; i < l; i++) {
|
|
124
|
+
const candidate = candidates[i];
|
|
125
|
+
if (candidate && isFocusable(candidate, {
|
|
126
126
|
skipNegativeTabIndexCheck,
|
|
127
127
|
skipVisibilityCheck
|
|
128
128
|
})) {
|
|
129
|
-
|
|
129
|
+
elements[elements.length] = candidate;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
);
|
|
133
|
+
const filtered = filter ? elements.filter(filter) : elements;
|
|
134
|
+
return normalizeRadioGroup(sortByTabIndex(filtered));
|
|
136
135
|
}
|
|
137
136
|
function getNextFocusable(container = document.body, options = {}) {
|
|
138
137
|
return getRelativeFocusable(container, 1, options);
|
|
@@ -271,11 +270,11 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
271
270
|
if (!length) {
|
|
272
271
|
return null;
|
|
273
272
|
}
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
273
|
+
const currentIndex = focusables.indexOf(anchor);
|
|
274
|
+
if (currentIndex === -1) {
|
|
276
275
|
return null;
|
|
277
276
|
}
|
|
278
|
-
const offsetIndex =
|
|
277
|
+
const offsetIndex = currentIndex + offset;
|
|
279
278
|
if ((offsetIndex < 0 || offsetIndex >= length) && !wrap) {
|
|
280
279
|
return null;
|
|
281
280
|
}
|
|
@@ -494,7 +493,7 @@ function isUngroupedRadio(element) {
|
|
|
494
493
|
* High-precision focus management utility with full composed tree support.
|
|
495
494
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
496
495
|
*
|
|
497
|
-
* @version 4.3.
|
|
496
|
+
* @version 4.3.20
|
|
498
497
|
* @author Yusuke Kamiyamane
|
|
499
498
|
* @license MIT
|
|
500
499
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* High-precision focus management utility with full composed tree support.
|
|
4
4
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
5
5
|
*
|
|
6
|
-
* @version 4.3.
|
|
6
|
+
* @version 4.3.20
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* High-precision focus management utility with full composed tree support.
|
|
4
4
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
5
5
|
*
|
|
6
|
-
* @version 4.3.
|
|
6
|
+
* @version 4.3.20
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -94,14 +94,14 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
94
94
|
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
95
95
|
skipVisibilityCheck = false;
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const elements = [];
|
|
98
98
|
if (composed || include) {
|
|
99
99
|
let traverse2 = function(node) {
|
|
100
100
|
if (isFocusable(node, {
|
|
101
101
|
skipNegativeTabIndexCheck,
|
|
102
102
|
skipVisibilityCheck
|
|
103
103
|
}) || include?.(node)) {
|
|
104
|
-
|
|
104
|
+
elements[elements.length] = node;
|
|
105
105
|
}
|
|
106
106
|
const children2 = composed ? getComposedChildren(node) : getChildren(node);
|
|
107
107
|
for (let i = 0, l = children2.length; i < l; i++) {
|
|
@@ -115,22 +115,21 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
115
115
|
child && traverse2(child);
|
|
116
116
|
}
|
|
117
117
|
} else {
|
|
118
|
-
const
|
|
118
|
+
const candidates = container.querySelectorAll(
|
|
119
119
|
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
120
120
|
);
|
|
121
|
-
for (let i = 0, l =
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
121
|
+
for (let i = 0, l = candidates.length; i < l; i++) {
|
|
122
|
+
const candidate = candidates[i];
|
|
123
|
+
if (candidate && isFocusable(candidate, {
|
|
124
124
|
skipNegativeTabIndexCheck,
|
|
125
125
|
skipVisibilityCheck
|
|
126
126
|
})) {
|
|
127
|
-
|
|
127
|
+
elements[elements.length] = candidate;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
);
|
|
131
|
+
const filtered = filter ? elements.filter(filter) : elements;
|
|
132
|
+
return normalizeRadioGroup(sortByTabIndex(filtered));
|
|
134
133
|
}
|
|
135
134
|
function getNextFocusable(container = document.body, options = {}) {
|
|
136
135
|
return getRelativeFocusable(container, 1, options);
|
|
@@ -269,11 +268,11 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
269
268
|
if (!length) {
|
|
270
269
|
return null;
|
|
271
270
|
}
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
271
|
+
const currentIndex = focusables.indexOf(anchor);
|
|
272
|
+
if (currentIndex === -1) {
|
|
274
273
|
return null;
|
|
275
274
|
}
|
|
276
|
-
const offsetIndex =
|
|
275
|
+
const offsetIndex = currentIndex + offset;
|
|
277
276
|
if ((offsetIndex < 0 || offsetIndex >= length) && !wrap) {
|
|
278
277
|
return null;
|
|
279
278
|
}
|
|
@@ -492,7 +491,7 @@ function isUngroupedRadio(element) {
|
|
|
492
491
|
* High-precision focus management utility with full composed tree support.
|
|
493
492
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
494
493
|
*
|
|
495
|
-
* @version 4.3.
|
|
494
|
+
* @version 4.3.20
|
|
496
495
|
* @author Yusuke Kamiyamane
|
|
497
496
|
* @license MIT
|
|
498
497
|
* @copyright Copyright (c) Yusuke Kamiyamane
|