power-focusable 4.3.15 → 4.3.16
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 -15
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- 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.16';
|
|
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.16/+esm';
|
|
30
30
|
// or
|
|
31
|
-
import { ... } 'https://esm.unpkg.com/power-focusable@4.3.
|
|
31
|
+
import { ... } 'https://esm.unpkg.com/power-focusable@4.3.16';
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## 🪄 Options
|
|
@@ -121,9 +121,6 @@ getFocusables(container, { composed: true });
|
|
|
121
121
|
|
|
122
122
|
// Uses custom filter function
|
|
123
123
|
getFocusables(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
124
|
-
|
|
125
|
-
// Uses custom include function
|
|
126
|
-
getFocusables(container, { filter: (element) => element.matches('[data-force-focusable]') });
|
|
127
124
|
```
|
|
128
125
|
|
|
129
126
|
### `getNextFocusable`
|
|
@@ -145,9 +142,6 @@ getNextFocusable(container, { composed: true });
|
|
|
145
142
|
// Uses custom filter function
|
|
146
143
|
getNextFocusable(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
147
144
|
|
|
148
|
-
// Uses custom include function
|
|
149
|
-
getNextFocusable(container, { filter: (element) => element.matches('[data-force-focusable]') });
|
|
150
|
-
|
|
151
145
|
// Wraps around to the first element when reaching the end
|
|
152
146
|
getNextFocusable(container, { wrap: true });
|
|
153
147
|
```
|
|
@@ -171,9 +165,6 @@ getPreviousFocusable(container, { composed: true });
|
|
|
171
165
|
// Uses custom filter function
|
|
172
166
|
getPreviousFocusable(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
173
167
|
|
|
174
|
-
// Uses custom include function
|
|
175
|
-
getPreviousFocusable(container, { filter: (element) => element.matches('[data-force-focusable]') });
|
|
176
|
-
|
|
177
168
|
// Wraps around to the last element when reaching the end
|
|
178
169
|
getPreviousFocusable(container, { wrap: true });
|
|
179
170
|
|
|
@@ -194,9 +185,6 @@ hasFocusable(container, { composed: true });
|
|
|
194
185
|
|
|
195
186
|
// Uses custom filter function
|
|
196
187
|
hasFocusable(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
197
|
-
|
|
198
|
-
// Uses custom include function
|
|
199
|
-
hasFocusable(container, { filter: (element) => element.matches('[data-force-focusable]') });
|
|
200
188
|
```
|
|
201
189
|
|
|
202
190
|
### `inertOutside`
|
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
|
-
var
|
|
5
|
+
var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
|
|
6
6
|
/(,\s*)?\[tabindex="-1"\]/g,
|
|
7
7
|
""
|
|
8
8
|
);
|
|
@@ -118,7 +118,7 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
118
118
|
}
|
|
119
119
|
} else {
|
|
120
120
|
const candidates = container.querySelectorAll(
|
|
121
|
-
skipNegativeTabIndexCheck ?
|
|
121
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
122
122
|
);
|
|
123
123
|
for (let i = 0, l = candidates.length; i < l; i++) {
|
|
124
124
|
const candidate = candidates[i];
|
|
@@ -186,7 +186,7 @@ function isFocusable(element, options = {}) {
|
|
|
186
186
|
return false;
|
|
187
187
|
}
|
|
188
188
|
if (!element.matches(
|
|
189
|
-
skipNegativeTabIndexCheck ?
|
|
189
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
190
190
|
)) {
|
|
191
191
|
return false;
|
|
192
192
|
}
|
|
@@ -493,7 +493,7 @@ function isUngroupedRadio(element) {
|
|
|
493
493
|
* High-precision focus management utility with full composed tree support.
|
|
494
494
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
495
495
|
*
|
|
496
|
-
* @version 4.3.
|
|
496
|
+
* @version 4.3.16
|
|
497
497
|
* @author Yusuke Kamiyamane
|
|
498
498
|
* @license MIT
|
|
499
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.16
|
|
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.16
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
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
|
-
var
|
|
3
|
+
var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
|
|
4
4
|
/(,\s*)?\[tabindex="-1"\]/g,
|
|
5
5
|
""
|
|
6
6
|
);
|
|
@@ -116,7 +116,7 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
116
116
|
}
|
|
117
117
|
} else {
|
|
118
118
|
const candidates = container.querySelectorAll(
|
|
119
|
-
skipNegativeTabIndexCheck ?
|
|
119
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
120
120
|
);
|
|
121
121
|
for (let i = 0, l = candidates.length; i < l; i++) {
|
|
122
122
|
const candidate = candidates[i];
|
|
@@ -184,7 +184,7 @@ function isFocusable(element, options = {}) {
|
|
|
184
184
|
return false;
|
|
185
185
|
}
|
|
186
186
|
if (!element.matches(
|
|
187
|
-
skipNegativeTabIndexCheck ?
|
|
187
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
188
188
|
)) {
|
|
189
189
|
return false;
|
|
190
190
|
}
|
|
@@ -491,7 +491,7 @@ function isUngroupedRadio(element) {
|
|
|
491
491
|
* High-precision focus management utility with full composed tree support.
|
|
492
492
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
493
493
|
*
|
|
494
|
-
* @version 4.3.
|
|
494
|
+
* @version 4.3.16
|
|
495
495
|
* @author Yusuke Kamiyamane
|
|
496
496
|
* @license MIT
|
|
497
497
|
* @copyright Copyright (c) Yusuke Kamiyamane
|