@y14e/roving-tabindex 1.1.4 → 1.2.0
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 +15 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -45,14 +45,17 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
45
45
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
46
46
|
container = document.body;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
let { composed = false, filter, include } = options;
|
|
49
|
+
if (typeof composed !== "boolean") {
|
|
50
|
+
console.warn("Invalid composed. Fallback: false.");
|
|
51
|
+
composed = false;
|
|
52
|
+
}
|
|
53
|
+
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
54
|
+
console.warn("Invalid filter. Fallback: no filter function (undefined).");
|
|
52
55
|
filter = void 0;
|
|
53
56
|
}
|
|
54
|
-
if (include && typeof include !== "function") {
|
|
55
|
-
console.warn("Invalid include function");
|
|
57
|
+
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
58
|
+
console.warn("Invalid include. Fallback: no include function (undefined).");
|
|
56
59
|
include = void 0;
|
|
57
60
|
}
|
|
58
61
|
const elements = [];
|
|
@@ -324,7 +327,7 @@ var RovingTabIndex = class {
|
|
|
324
327
|
...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
|
|
325
328
|
...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
|
|
326
329
|
].includes(key)) {
|
|
327
|
-
if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.
|
|
330
|
+
if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
|
|
328
331
|
return;
|
|
329
332
|
}
|
|
330
333
|
}
|
|
@@ -363,7 +366,7 @@ var RovingTabIndex = class {
|
|
|
363
366
|
if (!typeahead) {
|
|
364
367
|
break;
|
|
365
368
|
}
|
|
366
|
-
target = this.#focusablesByFirstChar.get(key.
|
|
369
|
+
target = this.#focusablesByFirstChar.get(key.toUpperCase()) ?? [];
|
|
367
370
|
const foundIndex = target.findIndex(
|
|
368
371
|
(focusable2) => focusables.indexOf(focusable2) > currentIndex
|
|
369
372
|
);
|
|
@@ -412,9 +415,9 @@ var RovingTabIndex = class {
|
|
|
412
415
|
}
|
|
413
416
|
const shortcuts = c.ariaKeyShortcuts?.trim() ?? "";
|
|
414
417
|
const keys = new Set(
|
|
415
|
-
shortcuts ? shortcuts.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.
|
|
418
|
+
shortcuts ? shortcuts.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
|
|
416
419
|
);
|
|
417
|
-
const char = c.textContent?.trim()?.at(0)?.
|
|
420
|
+
const char = c.textContent?.trim()?.at(0)?.toUpperCase();
|
|
418
421
|
if (char) {
|
|
419
422
|
keys.add(char);
|
|
420
423
|
saveAttributes([c], ["aria-keyshortcuts"]);
|
|
@@ -463,7 +466,7 @@ function getActiveElement() {
|
|
|
463
466
|
* Lightweight roving tabindex utility with fully focus management.
|
|
464
467
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
465
468
|
*
|
|
466
|
-
* @version 1.
|
|
469
|
+
* @version 1.2.0
|
|
467
470
|
* @author Yusuke Kamiyamane
|
|
468
471
|
* @license MIT
|
|
469
472
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -488,7 +491,7 @@ power-focusable/dist/index.js:
|
|
|
488
491
|
* High-precision focus management utility with full composed tree support.
|
|
489
492
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
490
493
|
*
|
|
491
|
-
* @version 4.1.
|
|
494
|
+
* @version 4.1.7
|
|
492
495
|
* @author Yusuke Kamiyamane
|
|
493
496
|
* @license MIT
|
|
494
497
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Lightweight roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.
|
|
6
|
+
* @version 1.2.0
|
|
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
|
* Lightweight roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.
|
|
6
|
+
* @version 1.2.0
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -43,14 +43,17 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
43
43
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
44
44
|
container = document.body;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
let { composed = false, filter, include } = options;
|
|
47
|
+
if (typeof composed !== "boolean") {
|
|
48
|
+
console.warn("Invalid composed. Fallback: false.");
|
|
49
|
+
composed = false;
|
|
50
|
+
}
|
|
51
|
+
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
52
|
+
console.warn("Invalid filter. Fallback: no filter function (undefined).");
|
|
50
53
|
filter = void 0;
|
|
51
54
|
}
|
|
52
|
-
if (include && typeof include !== "function") {
|
|
53
|
-
console.warn("Invalid include function");
|
|
55
|
+
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
56
|
+
console.warn("Invalid include. Fallback: no include function (undefined).");
|
|
54
57
|
include = void 0;
|
|
55
58
|
}
|
|
56
59
|
const elements = [];
|
|
@@ -322,7 +325,7 @@ var RovingTabIndex = class {
|
|
|
322
325
|
...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
|
|
323
326
|
...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
|
|
324
327
|
].includes(key)) {
|
|
325
|
-
if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.
|
|
328
|
+
if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
|
|
326
329
|
return;
|
|
327
330
|
}
|
|
328
331
|
}
|
|
@@ -361,7 +364,7 @@ var RovingTabIndex = class {
|
|
|
361
364
|
if (!typeahead) {
|
|
362
365
|
break;
|
|
363
366
|
}
|
|
364
|
-
target = this.#focusablesByFirstChar.get(key.
|
|
367
|
+
target = this.#focusablesByFirstChar.get(key.toUpperCase()) ?? [];
|
|
365
368
|
const foundIndex = target.findIndex(
|
|
366
369
|
(focusable2) => focusables.indexOf(focusable2) > currentIndex
|
|
367
370
|
);
|
|
@@ -410,9 +413,9 @@ var RovingTabIndex = class {
|
|
|
410
413
|
}
|
|
411
414
|
const shortcuts = c.ariaKeyShortcuts?.trim() ?? "";
|
|
412
415
|
const keys = new Set(
|
|
413
|
-
shortcuts ? shortcuts.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.
|
|
416
|
+
shortcuts ? shortcuts.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
|
|
414
417
|
);
|
|
415
|
-
const char = c.textContent?.trim()?.at(0)?.
|
|
418
|
+
const char = c.textContent?.trim()?.at(0)?.toUpperCase();
|
|
416
419
|
if (char) {
|
|
417
420
|
keys.add(char);
|
|
418
421
|
saveAttributes([c], ["aria-keyshortcuts"]);
|
|
@@ -461,7 +464,7 @@ function getActiveElement() {
|
|
|
461
464
|
* Lightweight roving tabindex utility with fully focus management.
|
|
462
465
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
463
466
|
*
|
|
464
|
-
* @version 1.
|
|
467
|
+
* @version 1.2.0
|
|
465
468
|
* @author Yusuke Kamiyamane
|
|
466
469
|
* @license MIT
|
|
467
470
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -486,7 +489,7 @@ power-focusable/dist/index.js:
|
|
|
486
489
|
* High-precision focus management utility with full composed tree support.
|
|
487
490
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
488
491
|
*
|
|
489
|
-
* @version 4.1.
|
|
492
|
+
* @version 4.1.7
|
|
490
493
|
* @author Yusuke Kamiyamane
|
|
491
494
|
* @license MIT
|
|
492
495
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/roving-tabindex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Lightweight roving tabindex utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@y14e/attributes-utils": "^1.0.0",
|
|
52
52
|
"bun-types": "latest",
|
|
53
|
-
"power-focusable": "^4.1.
|
|
53
|
+
"power-focusable": "^4.1.7",
|
|
54
54
|
"tsup": "^8.0.0",
|
|
55
55
|
"typescript": "^5.6.0"
|
|
56
56
|
},
|