@y14e/roving-tabindex 3.0.14 → 3.0.16

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.14';
13
+ import { createRovingTabIndex } from '@y14e/roving-tabindex@3.0.16';
14
14
 
15
15
  // CDNs
16
- import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.14';
16
+ import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.16';
17
17
  // or
18
- import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.14/+esm';
18
+ import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.16/+esm';
19
19
  // or
20
- import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.14';
20
+ import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.16';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -387,6 +387,10 @@ var RovingTabIndex = class _RovingTabIndex {
387
387
  capture: true,
388
388
  signal
389
389
  });
390
+ document.addEventListener("focusout", this.#onFocusOut, {
391
+ capture: true,
392
+ signal
393
+ });
390
394
  this.#container.addEventListener("keydown", this.#onKeyDown, {
391
395
  capture: true,
392
396
  signal
@@ -400,6 +404,11 @@ var RovingTabIndex = class _RovingTabIndex {
400
404
  const isFocusable2 = this.#focusables.has(target);
401
405
  this.#settings.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
402
406
  };
407
+ #onFocusOut = (event) => {
408
+ if (this.#settings.noMemory && !event.relatedTarget) {
409
+ this.#update(null);
410
+ }
411
+ };
403
412
  #onKeyDown = (event) => {
404
413
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
405
414
  if (altKey || ctrlKey || metaKey || shiftKey) {
@@ -537,7 +546,7 @@ var RovingTabIndex = class _RovingTabIndex {
537
546
  * Lightweight roving tabindex utility with fully focus management.
538
547
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
539
548
  *
540
- * @version 3.0.14
549
+ * @version 3.0.16
541
550
  * @author Yusuke Kamiyamane
542
551
  * @license MIT
543
552
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -385,6 +385,10 @@ var RovingTabIndex = class _RovingTabIndex {
385
385
  capture: true,
386
386
  signal
387
387
  });
388
+ document.addEventListener("focusout", this.#onFocusOut, {
389
+ capture: true,
390
+ signal
391
+ });
388
392
  this.#container.addEventListener("keydown", this.#onKeyDown, {
389
393
  capture: true,
390
394
  signal
@@ -398,6 +402,11 @@ var RovingTabIndex = class _RovingTabIndex {
398
402
  const isFocusable2 = this.#focusables.has(target);
399
403
  this.#settings.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
400
404
  };
405
+ #onFocusOut = (event) => {
406
+ if (this.#settings.noMemory && !event.relatedTarget) {
407
+ this.#update(null);
408
+ }
409
+ };
401
410
  #onKeyDown = (event) => {
402
411
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
403
412
  if (altKey || ctrlKey || metaKey || shiftKey) {
@@ -535,7 +544,7 @@ var RovingTabIndex = class _RovingTabIndex {
535
544
  * Lightweight roving tabindex utility with fully focus management.
536
545
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
537
546
  *
538
- * @version 3.0.14
547
+ * @version 3.0.16
539
548
  * @author Yusuke Kamiyamane
540
549
  * @license MIT
541
550
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -103,6 +103,10 @@ var RovingTabIndex = class _RovingTabIndex {
103
103
  capture: true,
104
104
  signal
105
105
  });
106
+ document.addEventListener("focusout", this.#onFocusOut, {
107
+ capture: true,
108
+ signal
109
+ });
106
110
  this.#container.addEventListener("keydown", this.#onKeyDown, {
107
111
  capture: true,
108
112
  signal
@@ -116,6 +120,11 @@ var RovingTabIndex = class _RovingTabIndex {
116
120
  const isFocusable = this.#focusables.has(target);
117
121
  this.#settings.noMemory && !isFocusable ? this.#update(null) : isFocusable && this.#update(target);
118
122
  };
123
+ #onFocusOut = (event) => {
124
+ if (this.#settings.noMemory && !event.relatedTarget) {
125
+ this.#update(null);
126
+ }
127
+ };
119
128
  #onKeyDown = (event) => {
120
129
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
121
130
  if (altKey || ctrlKey || metaKey || shiftKey) {
@@ -253,7 +262,7 @@ var RovingTabIndex = class _RovingTabIndex {
253
262
  * Lightweight roving tabindex utility with fully focus management.
254
263
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
255
264
  *
256
- * @version 3.0.14
265
+ * @version 3.0.16
257
266
  * @author Yusuke Kamiyamane
258
267
  * @license MIT
259
268
  * @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.14
6
+ * @version 3.0.16
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.14
6
+ * @version 3.0.16
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -101,6 +101,10 @@ var RovingTabIndex = class _RovingTabIndex {
101
101
  capture: true,
102
102
  signal
103
103
  });
104
+ document.addEventListener("focusout", this.#onFocusOut, {
105
+ capture: true,
106
+ signal
107
+ });
104
108
  this.#container.addEventListener("keydown", this.#onKeyDown, {
105
109
  capture: true,
106
110
  signal
@@ -114,6 +118,11 @@ var RovingTabIndex = class _RovingTabIndex {
114
118
  const isFocusable = this.#focusables.has(target);
115
119
  this.#settings.noMemory && !isFocusable ? this.#update(null) : isFocusable && this.#update(target);
116
120
  };
121
+ #onFocusOut = (event) => {
122
+ if (this.#settings.noMemory && !event.relatedTarget) {
123
+ this.#update(null);
124
+ }
125
+ };
117
126
  #onKeyDown = (event) => {
118
127
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
119
128
  if (altKey || ctrlKey || metaKey || shiftKey) {
@@ -251,7 +260,7 @@ var RovingTabIndex = class _RovingTabIndex {
251
260
  * Lightweight roving tabindex utility with fully focus management.
252
261
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
253
262
  *
254
- * @version 3.0.14
263
+ * @version 3.0.16
255
264
  * @author Yusuke Kamiyamane
256
265
  * @license MIT
257
266
  * @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.14",
3
+ "version": "3.0.16",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",