power-focusable 4.1.4 → 4.1.5
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 +15 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,11 +105,14 @@ getFocusables(container, { composed: true });
|
|
|
105
105
|
|
|
106
106
|
// Uses custom filter function
|
|
107
107
|
getFocusables(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
108
|
+
|
|
109
|
+
// Uses custom include function
|
|
110
|
+
getFocusables(container, { filter: (element) => element.matches('[data-roving-tabindex]') });
|
|
108
111
|
```
|
|
109
112
|
|
|
110
113
|
### `getNextFocusable`
|
|
111
114
|
|
|
112
|
-
Returns the next focusable element within the container, starting from
|
|
115
|
+
Returns the next focusable element within the container, starting from active element.
|
|
113
116
|
|
|
114
117
|
```ts
|
|
115
118
|
getNextFocusable(container);
|
|
@@ -126,13 +129,16 @@ getNextFocusable(container, { composed: true });
|
|
|
126
129
|
// Uses custom filter function
|
|
127
130
|
getNextFocusable(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
128
131
|
|
|
132
|
+
// Uses custom include function
|
|
133
|
+
getNextFocusable(container, { filter: (element) => element.matches('[data-roving-tabindex]') });
|
|
134
|
+
|
|
129
135
|
// Wraps around to the first element when reaching the end
|
|
130
136
|
getNextFocusable(container, { wrap: true });
|
|
131
137
|
```
|
|
132
138
|
|
|
133
139
|
### `getPreviousFocusable`
|
|
134
140
|
|
|
135
|
-
Returns the previous focusable element within the container, starting from
|
|
141
|
+
Returns the previous focusable element within the container, starting from active element.
|
|
136
142
|
|
|
137
143
|
```ts
|
|
138
144
|
getPreviousFocusable(container);
|
|
@@ -149,7 +155,10 @@ getPreviousFocusable(container, { composed: true });
|
|
|
149
155
|
// Uses custom filter function
|
|
150
156
|
getPreviousFocusable(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
151
157
|
|
|
152
|
-
//
|
|
158
|
+
// Uses custom include function
|
|
159
|
+
getPreviousFocusable(container, { filter: (element) => element.matches('[data-roving-tabindex]') });
|
|
160
|
+
|
|
161
|
+
// Wraps around to the last element when reaching the end
|
|
153
162
|
getPreviousFocusable(container, { wrap: true });
|
|
154
163
|
|
|
155
164
|
```
|
|
@@ -169,6 +178,9 @@ hasFocusable(container, { composed: true });
|
|
|
169
178
|
|
|
170
179
|
// Uses custom filter function
|
|
171
180
|
hasFocusable(container, { filter: (element) => !element.matches('[data-skip-focus]') });
|
|
181
|
+
|
|
182
|
+
// Uses custom include function
|
|
183
|
+
hasFocusable(container, { filter: (element) => element.matches('[data-roving-tabindex]') });
|
|
172
184
|
```
|
|
173
185
|
|
|
174
186
|
### `inertOutside`
|
package/dist/index.cjs
CHANGED
|
@@ -345,7 +345,7 @@ function applyInert(element) {
|
|
|
345
345
|
}
|
|
346
346
|
const count = inertRefCounts.get(element) ?? 0;
|
|
347
347
|
inertRefCounts.set(element, count + 1);
|
|
348
|
-
count === 0 && element.
|
|
348
|
+
count === 0 && element.setAttribute("inert", "");
|
|
349
349
|
return true;
|
|
350
350
|
}
|
|
351
351
|
function restoreInert(element) {
|
|
@@ -355,7 +355,7 @@ function restoreInert(element) {
|
|
|
355
355
|
}
|
|
356
356
|
if (count === 1) {
|
|
357
357
|
inertRefCounts.delete(element);
|
|
358
|
-
element.
|
|
358
|
+
element.removeAttribute("inert");
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
361
|
inertRefCounts.set(element, count - 1);
|
|
@@ -411,7 +411,7 @@ function isUngroupedRadio(element) {
|
|
|
411
411
|
* High-precision focus management utility with full composed tree support.
|
|
412
412
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
413
413
|
*
|
|
414
|
-
* @version 4.1.
|
|
414
|
+
* @version 4.1.5
|
|
415
415
|
* @author Yusuke Kamiyamane
|
|
416
416
|
* @license MIT
|
|
417
417
|
* @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.1.
|
|
6
|
+
* @version 4.1.5
|
|
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.1.
|
|
6
|
+
* @version 4.1.5
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -343,7 +343,7 @@ function applyInert(element) {
|
|
|
343
343
|
}
|
|
344
344
|
const count = inertRefCounts.get(element) ?? 0;
|
|
345
345
|
inertRefCounts.set(element, count + 1);
|
|
346
|
-
count === 0 && element.
|
|
346
|
+
count === 0 && element.setAttribute("inert", "");
|
|
347
347
|
return true;
|
|
348
348
|
}
|
|
349
349
|
function restoreInert(element) {
|
|
@@ -353,7 +353,7 @@ function restoreInert(element) {
|
|
|
353
353
|
}
|
|
354
354
|
if (count === 1) {
|
|
355
355
|
inertRefCounts.delete(element);
|
|
356
|
-
element.
|
|
356
|
+
element.removeAttribute("inert");
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
359
|
inertRefCounts.set(element, count - 1);
|
|
@@ -409,7 +409,7 @@ function isUngroupedRadio(element) {
|
|
|
409
409
|
* High-precision focus management utility with full composed tree support.
|
|
410
410
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
411
411
|
*
|
|
412
|
-
* @version 4.1.
|
|
412
|
+
* @version 4.1.5
|
|
413
413
|
* @author Yusuke Kamiyamane
|
|
414
414
|
* @license MIT
|
|
415
415
|
* @copyright Copyright (c) Yusuke Kamiyamane
|