@y14e/roving-tabindex 1.3.0 → 1.3.1

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
@@ -57,7 +57,12 @@ function getFocusables(container = document.body, options = {}) {
57
57
  console.warn("Invalid container element. Fallback: <body> element.");
58
58
  container = document.body;
59
59
  }
60
- let { composed = false, filter, include } = options;
60
+ let {
61
+ composed = false,
62
+ filter,
63
+ include,
64
+ skipVisibilityCheck = false
65
+ } = options;
61
66
  if (typeof composed !== "boolean") {
62
67
  console.warn("Invalid composed option. Fallback: false.");
63
68
  composed = false;
@@ -78,7 +83,7 @@ function getFocusables(container = document.body, options = {}) {
78
83
  if (composed || include) {
79
84
  let traverse2 = function(node) {
80
85
  if (node instanceof Element) {
81
- if (isFocusable(node) || include?.(node)) {
86
+ if (isFocusable(node, { skipVisibilityCheck }) || include?.(node)) {
82
87
  elements[elements.length] = node;
83
88
  }
84
89
  }
@@ -99,7 +104,7 @@ function getFocusables(container = document.body, options = {}) {
99
104
  if (!(candidate instanceof Element)) {
100
105
  continue;
101
106
  }
102
- if (isFocusable(candidate)) {
107
+ if (isFocusable(candidate, { skipVisibilityCheck })) {
103
108
  elements[elements.length] = candidate;
104
109
  }
105
110
  }
@@ -107,11 +112,16 @@ function getFocusables(container = document.body, options = {}) {
107
112
  const unfiltered = normalizeRadioGroup(sortByTabIndex(elements));
108
113
  return filter ? unfiltered.filter(filter) : unfiltered;
109
114
  }
110
- function isFocusable(element) {
115
+ function isFocusable(element, options = {}) {
111
116
  if (!(element instanceof Element)) {
112
117
  console.warn("Invalid element");
113
118
  return false;
114
119
  }
120
+ let { skipVisibilityCheck = false } = options;
121
+ if (typeof skipVisibilityCheck !== "boolean") {
122
+ console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
123
+ skipVisibilityCheck = false;
124
+ }
115
125
  if (element.hasAttribute("hidden") || isInert(element)) {
116
126
  return false;
117
127
  }
@@ -124,7 +134,7 @@ function isFocusable(element) {
124
134
  if (isDisabledDeep(element)) {
125
135
  return false;
126
136
  }
127
- if (!element.checkVisibility({
137
+ if (!skipVisibilityCheck && !element.checkVisibility({
128
138
  contentVisibilityAuto: true,
129
139
  opacityProperty: true,
130
140
  visibilityProperty: true
@@ -411,7 +421,8 @@ var RovingTabIndex = class {
411
421
  ...this.#getFocusables(),
412
422
  ...getFocusables(this.#container, {
413
423
  composed: true,
414
- filter: this.#selectorFilter
424
+ filter: this.#selectorFilter,
425
+ skipVisibilityCheck: true
415
426
  })
416
427
  ]);
417
428
  for (const focusable of this.#focusables) {
@@ -477,7 +488,8 @@ var RovingTabIndex = class {
477
488
  return getFocusables(this.#container, {
478
489
  composed: true,
479
490
  filter: this.#selectorFilter,
480
- include: (element) => this.#focusables.has(element)
491
+ include: (element) => this.#focusables.has(element),
492
+ skipVisibilityCheck: true
481
493
  });
482
494
  }
483
495
  };
@@ -496,7 +508,7 @@ function getActiveElement() {
496
508
  * Lightweight roving tabindex utility with fully focus management.
497
509
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
498
510
  *
499
- * @version 1.3.0
511
+ * @version 1.3.1
500
512
  * @author Yusuke Kamiyamane
501
513
  * @license MIT
502
514
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -521,7 +533,7 @@ power-focusable/dist/index.js:
521
533
  * High-precision focus management utility with full composed tree support.
522
534
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
523
535
  *
524
- * @version 4.1.8
536
+ * @version 4.2.0
525
537
  * @author Yusuke Kamiyamane
526
538
  * @license MIT
527
539
  * @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.3.0
6
+ * @version 1.3.1
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.3.0
6
+ * @version 1.3.1
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -55,7 +55,12 @@ function getFocusables(container = document.body, options = {}) {
55
55
  console.warn("Invalid container element. Fallback: <body> element.");
56
56
  container = document.body;
57
57
  }
58
- let { composed = false, filter, include } = options;
58
+ let {
59
+ composed = false,
60
+ filter,
61
+ include,
62
+ skipVisibilityCheck = false
63
+ } = options;
59
64
  if (typeof composed !== "boolean") {
60
65
  console.warn("Invalid composed option. Fallback: false.");
61
66
  composed = false;
@@ -76,7 +81,7 @@ function getFocusables(container = document.body, options = {}) {
76
81
  if (composed || include) {
77
82
  let traverse2 = function(node) {
78
83
  if (node instanceof Element) {
79
- if (isFocusable(node) || include?.(node)) {
84
+ if (isFocusable(node, { skipVisibilityCheck }) || include?.(node)) {
80
85
  elements[elements.length] = node;
81
86
  }
82
87
  }
@@ -97,7 +102,7 @@ function getFocusables(container = document.body, options = {}) {
97
102
  if (!(candidate instanceof Element)) {
98
103
  continue;
99
104
  }
100
- if (isFocusable(candidate)) {
105
+ if (isFocusable(candidate, { skipVisibilityCheck })) {
101
106
  elements[elements.length] = candidate;
102
107
  }
103
108
  }
@@ -105,11 +110,16 @@ function getFocusables(container = document.body, options = {}) {
105
110
  const unfiltered = normalizeRadioGroup(sortByTabIndex(elements));
106
111
  return filter ? unfiltered.filter(filter) : unfiltered;
107
112
  }
108
- function isFocusable(element) {
113
+ function isFocusable(element, options = {}) {
109
114
  if (!(element instanceof Element)) {
110
115
  console.warn("Invalid element");
111
116
  return false;
112
117
  }
118
+ let { skipVisibilityCheck = false } = options;
119
+ if (typeof skipVisibilityCheck !== "boolean") {
120
+ console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
121
+ skipVisibilityCheck = false;
122
+ }
113
123
  if (element.hasAttribute("hidden") || isInert(element)) {
114
124
  return false;
115
125
  }
@@ -122,7 +132,7 @@ function isFocusable(element) {
122
132
  if (isDisabledDeep(element)) {
123
133
  return false;
124
134
  }
125
- if (!element.checkVisibility({
135
+ if (!skipVisibilityCheck && !element.checkVisibility({
126
136
  contentVisibilityAuto: true,
127
137
  opacityProperty: true,
128
138
  visibilityProperty: true
@@ -409,7 +419,8 @@ var RovingTabIndex = class {
409
419
  ...this.#getFocusables(),
410
420
  ...getFocusables(this.#container, {
411
421
  composed: true,
412
- filter: this.#selectorFilter
422
+ filter: this.#selectorFilter,
423
+ skipVisibilityCheck: true
413
424
  })
414
425
  ]);
415
426
  for (const focusable of this.#focusables) {
@@ -475,7 +486,8 @@ var RovingTabIndex = class {
475
486
  return getFocusables(this.#container, {
476
487
  composed: true,
477
488
  filter: this.#selectorFilter,
478
- include: (element) => this.#focusables.has(element)
489
+ include: (element) => this.#focusables.has(element),
490
+ skipVisibilityCheck: true
479
491
  });
480
492
  }
481
493
  };
@@ -494,7 +506,7 @@ function getActiveElement() {
494
506
  * Lightweight roving tabindex utility with fully focus management.
495
507
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
496
508
  *
497
- * @version 1.3.0
509
+ * @version 1.3.1
498
510
  * @author Yusuke Kamiyamane
499
511
  * @license MIT
500
512
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -519,7 +531,7 @@ power-focusable/dist/index.js:
519
531
  * High-precision focus management utility with full composed tree support.
520
532
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
521
533
  *
522
- * @version 4.1.8
534
+ * @version 4.2.0
523
535
  * @author Yusuke Kamiyamane
524
536
  * @license MIT
525
537
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/roving-tabindex",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@y14e/attributes-utils": "^1.0.5",
52
52
  "bun-types": "latest",
53
- "power-focusable": "^4.1.8",
53
+ "power-focusable": "^4.2.0",
54
54
  "tsup": "^8.0.0",
55
55
  "typescript": "^5.6.0"
56
56
  },