@y14e/roving-tabindex 3.0.16 → 3.0.18

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.16';
13
+ import { createRovingTabIndex } from '@y14e/roving-tabindex@3.0.18';
14
14
 
15
15
  // CDNs
16
- import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.16';
16
+ import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.18';
17
17
  // or
18
- import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.16/+esm';
18
+ import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.18/+esm';
19
19
  // or
20
- import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.16';
20
+ import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.18';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -377,7 +377,7 @@ var RovingTabIndex = class _RovingTabIndex {
377
377
  this.#focusablesByFirstChar.clear();
378
378
  }
379
379
  #initialize() {
380
- this.#update(document.activeElement);
380
+ this.#update(getActiveElement());
381
381
  if (!(this.#container instanceof HTMLElement)) {
382
382
  return;
383
383
  }
@@ -387,7 +387,7 @@ var RovingTabIndex = class _RovingTabIndex {
387
387
  capture: true,
388
388
  signal
389
389
  });
390
- document.addEventListener("focusout", this.#onFocusOut, {
390
+ this.#settings.noMemory && document.addEventListener("focusout", this.#onFocusOut, {
391
391
  capture: true,
392
392
  signal
393
393
  });
@@ -402,11 +402,11 @@ var RovingTabIndex = class _RovingTabIndex {
402
402
  return;
403
403
  }
404
404
  const isFocusable2 = this.#focusables.has(target);
405
- this.#settings.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
405
+ this.#settings.noMemory && !isFocusable2 ? this.#update() : isFocusable2 && this.#update(target);
406
406
  };
407
407
  #onFocusOut = (event) => {
408
- if (this.#settings.noMemory && !event.relatedTarget) {
409
- this.#update(null);
408
+ if (!event.relatedTarget) {
409
+ this.#update();
410
410
  }
411
411
  };
412
412
  #onKeyDown = (event) => {
@@ -546,7 +546,7 @@ var RovingTabIndex = class _RovingTabIndex {
546
546
  * Lightweight roving tabindex utility with fully focus management.
547
547
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
548
548
  *
549
- * @version 3.0.16
549
+ * @version 3.0.18
550
550
  * @author Yusuke Kamiyamane
551
551
  * @license MIT
552
552
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -375,7 +375,7 @@ var RovingTabIndex = class _RovingTabIndex {
375
375
  this.#focusablesByFirstChar.clear();
376
376
  }
377
377
  #initialize() {
378
- this.#update(document.activeElement);
378
+ this.#update(getActiveElement());
379
379
  if (!(this.#container instanceof HTMLElement)) {
380
380
  return;
381
381
  }
@@ -385,7 +385,7 @@ var RovingTabIndex = class _RovingTabIndex {
385
385
  capture: true,
386
386
  signal
387
387
  });
388
- document.addEventListener("focusout", this.#onFocusOut, {
388
+ this.#settings.noMemory && document.addEventListener("focusout", this.#onFocusOut, {
389
389
  capture: true,
390
390
  signal
391
391
  });
@@ -400,11 +400,11 @@ var RovingTabIndex = class _RovingTabIndex {
400
400
  return;
401
401
  }
402
402
  const isFocusable2 = this.#focusables.has(target);
403
- this.#settings.noMemory && !isFocusable2 ? this.#update(null) : isFocusable2 && this.#update(target);
403
+ this.#settings.noMemory && !isFocusable2 ? this.#update() : isFocusable2 && this.#update(target);
404
404
  };
405
405
  #onFocusOut = (event) => {
406
- if (this.#settings.noMemory && !event.relatedTarget) {
407
- this.#update(null);
406
+ if (!event.relatedTarget) {
407
+ this.#update();
408
408
  }
409
409
  };
410
410
  #onKeyDown = (event) => {
@@ -544,7 +544,7 @@ var RovingTabIndex = class _RovingTabIndex {
544
544
  * Lightweight roving tabindex utility with fully focus management.
545
545
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
546
546
  *
547
- * @version 3.0.16
547
+ * @version 3.0.18
548
548
  * @author Yusuke Kamiyamane
549
549
  * @license MIT
550
550
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -93,7 +93,7 @@ var RovingTabIndex = class _RovingTabIndex {
93
93
  this.#focusablesByFirstChar.clear();
94
94
  }
95
95
  #initialize() {
96
- this.#update(document.activeElement);
96
+ this.#update(powerFocusable.getActiveElement());
97
97
  if (!(this.#container instanceof HTMLElement)) {
98
98
  return;
99
99
  }
@@ -103,7 +103,7 @@ var RovingTabIndex = class _RovingTabIndex {
103
103
  capture: true,
104
104
  signal
105
105
  });
106
- document.addEventListener("focusout", this.#onFocusOut, {
106
+ this.#settings.noMemory && document.addEventListener("focusout", this.#onFocusOut, {
107
107
  capture: true,
108
108
  signal
109
109
  });
@@ -118,11 +118,11 @@ var RovingTabIndex = class _RovingTabIndex {
118
118
  return;
119
119
  }
120
120
  const isFocusable = this.#focusables.has(target);
121
- this.#settings.noMemory && !isFocusable ? this.#update(null) : isFocusable && this.#update(target);
121
+ this.#settings.noMemory && !isFocusable ? this.#update() : isFocusable && this.#update(target);
122
122
  };
123
123
  #onFocusOut = (event) => {
124
- if (this.#settings.noMemory && !event.relatedTarget) {
125
- this.#update(null);
124
+ if (!event.relatedTarget) {
125
+ this.#update();
126
126
  }
127
127
  };
128
128
  #onKeyDown = (event) => {
@@ -262,7 +262,7 @@ var RovingTabIndex = class _RovingTabIndex {
262
262
  * Lightweight roving tabindex utility with fully focus management.
263
263
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
264
264
  *
265
- * @version 3.0.16
265
+ * @version 3.0.18
266
266
  * @author Yusuke Kamiyamane
267
267
  * @license MIT
268
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.16
6
+ * @version 3.0.18
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.16
6
+ * @version 3.0.18
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -91,7 +91,7 @@ var RovingTabIndex = class _RovingTabIndex {
91
91
  this.#focusablesByFirstChar.clear();
92
92
  }
93
93
  #initialize() {
94
- this.#update(document.activeElement);
94
+ this.#update(getActiveElement());
95
95
  if (!(this.#container instanceof HTMLElement)) {
96
96
  return;
97
97
  }
@@ -101,7 +101,7 @@ var RovingTabIndex = class _RovingTabIndex {
101
101
  capture: true,
102
102
  signal
103
103
  });
104
- document.addEventListener("focusout", this.#onFocusOut, {
104
+ this.#settings.noMemory && document.addEventListener("focusout", this.#onFocusOut, {
105
105
  capture: true,
106
106
  signal
107
107
  });
@@ -116,11 +116,11 @@ var RovingTabIndex = class _RovingTabIndex {
116
116
  return;
117
117
  }
118
118
  const isFocusable = this.#focusables.has(target);
119
- this.#settings.noMemory && !isFocusable ? this.#update(null) : isFocusable && this.#update(target);
119
+ this.#settings.noMemory && !isFocusable ? this.#update() : isFocusable && this.#update(target);
120
120
  };
121
121
  #onFocusOut = (event) => {
122
- if (this.#settings.noMemory && !event.relatedTarget) {
123
- this.#update(null);
122
+ if (!event.relatedTarget) {
123
+ this.#update();
124
124
  }
125
125
  };
126
126
  #onKeyDown = (event) => {
@@ -260,7 +260,7 @@ var RovingTabIndex = class _RovingTabIndex {
260
260
  * Lightweight roving tabindex utility with fully focus management.
261
261
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
262
262
  *
263
- * @version 3.0.16
263
+ * @version 3.0.18
264
264
  * @author Yusuke Kamiyamane
265
265
  * @license MIT
266
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.16",
3
+ "version": "3.0.18",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",