@y14e/roving-tabindex 1.2.2 → 1.2.3

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 CHANGED
@@ -337,10 +337,8 @@ var RovingTabIndex = class {
337
337
  "Home",
338
338
  ...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
339
339
  ...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
340
- ].includes(key)) {
341
- if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
342
- return;
343
- }
340
+ ].includes(key) && (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase()))) {
341
+ return;
344
342
  }
345
343
  const active = getActiveElement();
346
344
  if (!(active instanceof HTMLElement)) {
@@ -424,9 +422,9 @@ var RovingTabIndex = class {
424
422
  if (!this.#options.typeahead) {
425
423
  continue;
426
424
  }
427
- const shortcuts = c.ariaKeyShortcuts?.trim() ?? "";
425
+ const value = c.ariaKeyShortcuts?.trim();
428
426
  const keys = new Set(
429
- shortcuts ? shortcuts.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
427
+ value ? value.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
430
428
  );
431
429
  const char = c.textContent?.trim()?.at(0)?.toUpperCase();
432
430
  if (char) {
@@ -479,7 +477,7 @@ function getActiveElement() {
479
477
  * Lightweight roving tabindex utility with fully focus management.
480
478
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
481
479
  *
482
- * @version 1.2.2
480
+ * @version 1.2.3
483
481
  * @author Yusuke Kamiyamane
484
482
  * @license MIT
485
483
  * @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.2
6
+ * @version 1.2.3
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.2
6
+ * @version 1.2.3
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -335,10 +335,8 @@ var RovingTabIndex = class {
335
335
  "Home",
336
336
  ...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
337
337
  ...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
338
- ].includes(key)) {
339
- if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
340
- return;
341
- }
338
+ ].includes(key) && (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase()))) {
339
+ return;
342
340
  }
343
341
  const active = getActiveElement();
344
342
  if (!(active instanceof HTMLElement)) {
@@ -422,9 +420,9 @@ var RovingTabIndex = class {
422
420
  if (!this.#options.typeahead) {
423
421
  continue;
424
422
  }
425
- const shortcuts = c.ariaKeyShortcuts?.trim() ?? "";
423
+ const value = c.ariaKeyShortcuts?.trim();
426
424
  const keys = new Set(
427
- shortcuts ? shortcuts.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
425
+ value ? value.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
428
426
  );
429
427
  const char = c.textContent?.trim()?.at(0)?.toUpperCase();
430
428
  if (char) {
@@ -477,7 +475,7 @@ function getActiveElement() {
477
475
  * Lightweight roving tabindex utility with fully focus management.
478
476
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
479
477
  *
480
- * @version 1.2.2
478
+ * @version 1.2.3
481
479
  * @author Yusuke Kamiyamane
482
480
  * @license MIT
483
481
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/roving-tabindex",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",