@y14e/roving-tabindex 3.1.15 → 3.1.17

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
@@ -13,11 +13,11 @@ npm i @y14e/roving-tabindex
13
13
  import { createRovingTabIndex } from '@y14e/roving-tabindex';
14
14
 
15
15
  // CDNs
16
- import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.1.15';
16
+ import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.1.17';
17
17
  // or
18
- import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.1.15/+esm';
18
+ import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.1.17/+esm';
19
19
  // or
20
- import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.1.15';
20
+ import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.1.17';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -91,14 +91,14 @@ function getFocusables(container = document.body, options = {}) {
91
91
  console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
92
92
  skipVisibilityCheck = false;
93
93
  }
94
- const candidates = [];
94
+ const elements = [];
95
95
  if (composed || include) {
96
96
  let traverse2 = function(node) {
97
97
  if (isFocusable(node, {
98
98
  skipNegativeTabIndexCheck,
99
99
  skipVisibilityCheck
100
100
  }) || include?.(node)) {
101
- candidates[candidates.length] = node;
101
+ elements[elements.length] = node;
102
102
  }
103
103
  const children2 = composed ? getComposedChildren(node) : getChildren(node);
104
104
  for (let i = 0, l = children2.length; i < l; i++) {
@@ -112,22 +112,21 @@ function getFocusables(container = document.body, options = {}) {
112
112
  child && traverse2(child);
113
113
  }
114
114
  } else {
115
- const matches = container.querySelectorAll(
115
+ const candidates = container.querySelectorAll(
116
116
  skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
117
117
  );
118
- for (let i = 0, l = matches.length; i < l; i++) {
119
- const matched = matches[i];
120
- if (matched && isFocusable(matched, {
118
+ for (let i = 0, l = candidates.length; i < l; i++) {
119
+ const candidate = candidates[i];
120
+ if (candidate && isFocusable(candidate, {
121
121
  skipNegativeTabIndexCheck,
122
122
  skipVisibilityCheck
123
123
  })) {
124
- candidates[candidates.length] = matched;
124
+ elements[elements.length] = candidate;
125
125
  }
126
126
  }
127
127
  }
128
- return normalizeRadioGroup(
129
- sortByTabIndex(filter ? candidates.filter(filter) : candidates)
130
- );
128
+ const filtered = filter ? elements.filter(filter) : elements;
129
+ return normalizeRadioGroup(sortByTabIndex(filtered));
131
130
  }
132
131
  function isFocusable(element, options = {}) {
133
132
  if (!(element instanceof Element)) {
@@ -569,7 +568,7 @@ var RovingTabIndex = class _RovingTabIndex {
569
568
  }
570
569
  #createSelectorFilter() {
571
570
  const { selector } = this.#settings;
572
- return (element) => !selector || element.matches(selector);
571
+ return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
573
572
  }
574
573
  #getFocusables() {
575
574
  return getFocusables(this.#container, {
@@ -585,7 +584,7 @@ var RovingTabIndex = class _RovingTabIndex {
585
584
  * Lightweight roving tabindex utility with fully focus management.
586
585
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
587
586
  *
588
- * @version 3.1.15
587
+ * @version 3.1.17
589
588
  * @author Yusuke Kamiyamane
590
589
  * @license MIT
591
590
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -610,7 +609,7 @@ power-focusable/dist/index.js:
610
609
  * High-precision focus management utility with full composed tree support.
611
610
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
612
611
  *
613
- * @version 4.3.19
612
+ * @version 4.3.20
614
613
  * @author Yusuke Kamiyamane
615
614
  * @license MIT
616
615
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -89,14 +89,14 @@ function getFocusables(container = document.body, options = {}) {
89
89
  console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
90
90
  skipVisibilityCheck = false;
91
91
  }
92
- const candidates = [];
92
+ const elements = [];
93
93
  if (composed || include) {
94
94
  let traverse2 = function(node) {
95
95
  if (isFocusable(node, {
96
96
  skipNegativeTabIndexCheck,
97
97
  skipVisibilityCheck
98
98
  }) || include?.(node)) {
99
- candidates[candidates.length] = node;
99
+ elements[elements.length] = node;
100
100
  }
101
101
  const children2 = composed ? getComposedChildren(node) : getChildren(node);
102
102
  for (let i = 0, l = children2.length; i < l; i++) {
@@ -110,22 +110,21 @@ function getFocusables(container = document.body, options = {}) {
110
110
  child && traverse2(child);
111
111
  }
112
112
  } else {
113
- const matches = container.querySelectorAll(
113
+ const candidates = container.querySelectorAll(
114
114
  skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
115
115
  );
116
- for (let i = 0, l = matches.length; i < l; i++) {
117
- const matched = matches[i];
118
- if (matched && isFocusable(matched, {
116
+ for (let i = 0, l = candidates.length; i < l; i++) {
117
+ const candidate = candidates[i];
118
+ if (candidate && isFocusable(candidate, {
119
119
  skipNegativeTabIndexCheck,
120
120
  skipVisibilityCheck
121
121
  })) {
122
- candidates[candidates.length] = matched;
122
+ elements[elements.length] = candidate;
123
123
  }
124
124
  }
125
125
  }
126
- return normalizeRadioGroup(
127
- sortByTabIndex(filter ? candidates.filter(filter) : candidates)
128
- );
126
+ const filtered = filter ? elements.filter(filter) : elements;
127
+ return normalizeRadioGroup(sortByTabIndex(filtered));
129
128
  }
130
129
  function isFocusable(element, options = {}) {
131
130
  if (!(element instanceof Element)) {
@@ -567,7 +566,7 @@ var RovingTabIndex = class _RovingTabIndex {
567
566
  }
568
567
  #createSelectorFilter() {
569
568
  const { selector } = this.#settings;
570
- return (element) => !selector || element.matches(selector);
569
+ return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
571
570
  }
572
571
  #getFocusables() {
573
572
  return getFocusables(this.#container, {
@@ -583,7 +582,7 @@ var RovingTabIndex = class _RovingTabIndex {
583
582
  * Lightweight roving tabindex utility with fully focus management.
584
583
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
585
584
  *
586
- * @version 3.1.15
585
+ * @version 3.1.17
587
586
  * @author Yusuke Kamiyamane
588
587
  * @license MIT
589
588
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -608,7 +607,7 @@ power-focusable/dist/index.js:
608
607
  * High-precision focus management utility with full composed tree support.
609
608
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
610
609
  *
611
- * @version 4.3.19
610
+ * @version 4.3.20
612
611
  * @author Yusuke Kamiyamane
613
612
  * @license MIT
614
613
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -254,7 +254,7 @@ var RovingTabIndex = class _RovingTabIndex {
254
254
  }
255
255
  #createSelectorFilter() {
256
256
  const { selector } = this.#settings;
257
- return (element) => !selector || element.matches(selector);
257
+ return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
258
258
  }
259
259
  #getFocusables() {
260
260
  return powerFocusable.getFocusables(this.#container, {
@@ -270,7 +270,7 @@ var RovingTabIndex = class _RovingTabIndex {
270
270
  * Lightweight roving tabindex utility with fully focus management.
271
271
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
272
272
  *
273
- * @version 3.1.15
273
+ * @version 3.1.17
274
274
  * @author Yusuke Kamiyamane
275
275
  * @license MIT
276
276
  * @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.1.15
6
+ * @version 3.1.17
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.1.15
6
+ * @version 3.1.17
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -252,7 +252,7 @@ var RovingTabIndex = class _RovingTabIndex {
252
252
  }
253
253
  #createSelectorFilter() {
254
254
  const { selector } = this.#settings;
255
- return (element) => !selector || element.matches(selector);
255
+ return (element) => !selector || [...this.#container.querySelectorAll(selector)].includes(element);
256
256
  }
257
257
  #getFocusables() {
258
258
  return getFocusables(this.#container, {
@@ -268,7 +268,7 @@ var RovingTabIndex = class _RovingTabIndex {
268
268
  * Lightweight roving tabindex utility with fully focus management.
269
269
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
270
270
  *
271
- * @version 3.1.15
271
+ * @version 3.1.17
272
272
  * @author Yusuke Kamiyamane
273
273
  * @license MIT
274
274
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/roving-tabindex",
3
- "version": "3.1.15",
3
+ "version": "3.1.17",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -57,6 +57,6 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@y14e/attributes-utils": "^1.1.3",
60
- "power-focusable": "^4.3.19"
60
+ "power-focusable": "^4.3.20"
61
61
  }
62
62
  }