@y14e/roving-tabindex 3.0.2 → 3.0.4

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 CHANGED
@@ -10,14 +10,14 @@ npm i @y14e/roving-tabindex
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import { createRovingTabIndex } from '@y14e/roving-tabindex@3.0.2';
13
+ import { createRovingTabIndex } from '@y14e/roving-tabindex@3.0.4';
14
14
 
15
15
  // CDNs
16
- import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.2';
16
+ import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.4';
17
17
  // or
18
- import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.2/+esm';
18
+ import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.4/+esm';
19
19
  // or
20
- import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.2';
20
+ import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.4';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
package/dist/index.cjs CHANGED
@@ -377,11 +377,10 @@ var RovingTabIndex = class {
377
377
  }
378
378
  #onFocusIn = (event) => {
379
379
  const { target } = event;
380
- if (!(target instanceof Element)) {
381
- return;
380
+ if (target instanceof Element) {
381
+ const isFocusable2 = this.#focusables.has(target);
382
+ this.#options.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
382
383
  }
383
- const isFocusable2 = this.#focusables.has(target);
384
- this.#options.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
385
384
  };
386
385
  #onKeyDown = (event) => {
387
386
  if (!event.composedPath().includes(this.#container)) {
@@ -471,11 +470,11 @@ var RovingTabIndex = class {
471
470
  if (!typeahead) {
472
471
  continue;
473
472
  }
473
+ const char = focusable.textContent?.trim()?.at(0)?.toUpperCase();
474
474
  const value = focusable.ariaKeyShortcuts?.trim();
475
475
  const keys = new Set(
476
476
  value ? value.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
477
477
  );
478
- const char = focusable.textContent?.trim()?.at(0)?.toUpperCase();
479
478
  if (char) {
480
479
  keys.add(char);
481
480
  saveAttributes([focusable], ["aria-keyshortcuts"]);
@@ -529,7 +528,7 @@ function getActiveElement() {
529
528
  * Lightweight roving tabindex utility with fully focus management.
530
529
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
531
530
  *
532
- * @version 3.0.2
531
+ * @version 3.0.4
533
532
  * @author Yusuke Kamiyamane
534
533
  * @license MIT
535
534
  * @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 3.0.2
6
+ * @version 3.0.4
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 3.0.2
6
+ * @version 3.0.4
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -375,11 +375,10 @@ var RovingTabIndex = class {
375
375
  }
376
376
  #onFocusIn = (event) => {
377
377
  const { target } = event;
378
- if (!(target instanceof Element)) {
379
- return;
378
+ if (target instanceof Element) {
379
+ const isFocusable2 = this.#focusables.has(target);
380
+ this.#options.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
380
381
  }
381
- const isFocusable2 = this.#focusables.has(target);
382
- this.#options.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
383
382
  };
384
383
  #onKeyDown = (event) => {
385
384
  if (!event.composedPath().includes(this.#container)) {
@@ -469,11 +468,11 @@ var RovingTabIndex = class {
469
468
  if (!typeahead) {
470
469
  continue;
471
470
  }
471
+ const char = focusable.textContent?.trim()?.at(0)?.toUpperCase();
472
472
  const value = focusable.ariaKeyShortcuts?.trim();
473
473
  const keys = new Set(
474
474
  value ? value.split(/\s+/).filter((key) => /^\S$/i.test(key)).map((key) => key.toUpperCase()) : []
475
475
  );
476
- const char = focusable.textContent?.trim()?.at(0)?.toUpperCase();
477
476
  if (char) {
478
477
  keys.add(char);
479
478
  saveAttributes([focusable], ["aria-keyshortcuts"]);
@@ -527,7 +526,7 @@ function getActiveElement() {
527
526
  * Lightweight roving tabindex utility with fully focus management.
528
527
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
529
528
  *
530
- * @version 3.0.2
529
+ * @version 3.0.4
531
530
  * @author Yusuke Kamiyamane
532
531
  * @license MIT
533
532
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/roving-tabindex",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",