@y14e/roving-tabindex 1.2.8 → 1.2.9
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 +7 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -344,8 +344,10 @@ var RovingTabIndex = class {
|
|
|
344
344
|
"Home",
|
|
345
345
|
...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
|
|
346
346
|
...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
|
|
347
|
-
].includes(key)
|
|
348
|
-
|
|
347
|
+
].includes(key)) {
|
|
348
|
+
if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
349
351
|
}
|
|
350
352
|
const active = getActiveElement();
|
|
351
353
|
if (!(active instanceof HTMLElement)) {
|
|
@@ -408,15 +410,11 @@ var RovingTabIndex = class {
|
|
|
408
410
|
if (current.has(focusable)) {
|
|
409
411
|
continue;
|
|
410
412
|
}
|
|
411
|
-
|
|
412
|
-
restoreAttributes([focusable]);
|
|
413
|
-
}
|
|
413
|
+
focusable.isConnected && restoreAttributes([focusable]);
|
|
414
414
|
this.#focusables.delete(focusable);
|
|
415
415
|
this.#focusablesByFirstChar.forEach((focusables) => {
|
|
416
416
|
const index = focusables.indexOf(focusable);
|
|
417
|
-
|
|
418
|
-
focusables.splice(index, 1);
|
|
419
|
-
}
|
|
417
|
+
index >= 0 && focusables.splice(index, 1);
|
|
420
418
|
});
|
|
421
419
|
}
|
|
422
420
|
for (const focusable of current) {
|
|
@@ -484,7 +482,7 @@ function getActiveElement() {
|
|
|
484
482
|
* Lightweight roving tabindex utility with fully focus management.
|
|
485
483
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
486
484
|
*
|
|
487
|
-
* @version 1.2.
|
|
485
|
+
* @version 1.2.9
|
|
488
486
|
* @author Yusuke Kamiyamane
|
|
489
487
|
* @license MIT
|
|
490
488
|
* @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.2.
|
|
6
|
+
* @version 1.2.9
|
|
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.2.
|
|
6
|
+
* @version 1.2.9
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -342,8 +342,10 @@ var RovingTabIndex = class {
|
|
|
342
342
|
"Home",
|
|
343
343
|
...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
|
|
344
344
|
...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
|
|
345
|
-
].includes(key)
|
|
346
|
-
|
|
345
|
+
].includes(key)) {
|
|
346
|
+
if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
347
349
|
}
|
|
348
350
|
const active = getActiveElement();
|
|
349
351
|
if (!(active instanceof HTMLElement)) {
|
|
@@ -406,15 +408,11 @@ var RovingTabIndex = class {
|
|
|
406
408
|
if (current.has(focusable)) {
|
|
407
409
|
continue;
|
|
408
410
|
}
|
|
409
|
-
|
|
410
|
-
restoreAttributes([focusable]);
|
|
411
|
-
}
|
|
411
|
+
focusable.isConnected && restoreAttributes([focusable]);
|
|
412
412
|
this.#focusables.delete(focusable);
|
|
413
413
|
this.#focusablesByFirstChar.forEach((focusables) => {
|
|
414
414
|
const index = focusables.indexOf(focusable);
|
|
415
|
-
|
|
416
|
-
focusables.splice(index, 1);
|
|
417
|
-
}
|
|
415
|
+
index >= 0 && focusables.splice(index, 1);
|
|
418
416
|
});
|
|
419
417
|
}
|
|
420
418
|
for (const focusable of current) {
|
|
@@ -482,7 +480,7 @@ function getActiveElement() {
|
|
|
482
480
|
* Lightweight roving tabindex utility with fully focus management.
|
|
483
481
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
484
482
|
*
|
|
485
|
-
* @version 1.2.
|
|
483
|
+
* @version 1.2.9
|
|
486
484
|
* @author Yusuke Kamiyamane
|
|
487
485
|
* @license MIT
|
|
488
486
|
* @copyright Copyright (c) Yusuke Kamiyamane
|