@y14e/disclosure 1.3.10 → 1.3.11
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 +4 -4
- package/dist/index.cjs +54 -72
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -72
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/disclosure
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import Disclosure from '@y14e/disclosure@1.3.
|
|
13
|
+
import Disclosure from '@y14e/disclosure@1.3.11';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.
|
|
16
|
+
import Disclosure from 'https://esm.sh/@y14e/disclosure@1.3.11';
|
|
17
17
|
// or
|
|
18
|
-
import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.
|
|
18
|
+
import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure@1.3.11/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.
|
|
20
|
+
import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure@1.3.11';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -28,13 +28,13 @@ function saveAttributes(elements, attributes) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
31
|
-
var
|
|
32
|
-
var
|
|
31
|
+
var DEFAULT_PARSER = (value) => value.split(/\s+/);
|
|
32
|
+
var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
|
|
33
33
|
function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
34
34
|
const {
|
|
35
35
|
caseInsensitive = false,
|
|
36
|
-
parse =
|
|
37
|
-
serialize =
|
|
36
|
+
parse = DEFAULT_PARSER,
|
|
37
|
+
serialize = DEFAULT_SERIALIZER
|
|
38
38
|
} = options;
|
|
39
39
|
const value = element.getAttribute(attribute)?.trim();
|
|
40
40
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
@@ -44,11 +44,11 @@ function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
|
44
44
|
tokens.push(token);
|
|
45
45
|
element.setAttribute(attribute, serialize(tokens));
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
} else {
|
|
48
|
+
const set = new Set(tokens);
|
|
49
|
+
set.add(token);
|
|
50
|
+
element.setAttribute(attribute, serialize([...set]));
|
|
48
51
|
}
|
|
49
|
-
const set = new Set(tokens);
|
|
50
|
-
set.add(token);
|
|
51
|
-
element.setAttribute(attribute, serialize([...set]));
|
|
52
52
|
}
|
|
53
53
|
var snapshots2 = /* @__PURE__ */ new WeakMap();
|
|
54
54
|
function restoreAttributes2(elements) {
|
|
@@ -115,21 +115,16 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
115
115
|
const elements = [];
|
|
116
116
|
if (composed || include) {
|
|
117
117
|
let traverse2 = function(node) {
|
|
118
|
-
if (node instanceof Element) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
elements[elements.length] = node;
|
|
124
|
-
}
|
|
118
|
+
if (!(node instanceof Element)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (isFocusable(node, { skipNegativeTabIndexCheck, skipVisibilityCheck }) || include?.(node)) {
|
|
122
|
+
elements[elements.length] = node;
|
|
125
123
|
}
|
|
126
124
|
const children = getComposedChildren(node);
|
|
127
125
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
128
126
|
const child = children[i];
|
|
129
|
-
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
traverse2(child);
|
|
127
|
+
child && traverse2(child);
|
|
133
128
|
}
|
|
134
129
|
};
|
|
135
130
|
traverse2(container);
|
|
@@ -137,10 +132,7 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
137
132
|
const candidates = container.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
138
133
|
for (let i = 0, l = candidates.length; i < l; i++) {
|
|
139
134
|
const candidate = candidates[i];
|
|
140
|
-
if (
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (isFocusable(candidate, {
|
|
135
|
+
if (candidate && isFocusable(candidate, {
|
|
144
136
|
skipNegativeTabIndexCheck,
|
|
145
137
|
skipVisibilityCheck
|
|
146
138
|
})) {
|
|
@@ -243,23 +235,19 @@ function normalizeRadioGroup(elements) {
|
|
|
243
235
|
for (const group of map.values()) {
|
|
244
236
|
placeholder.add(group.find((radio) => radio.checked) ?? group[0]);
|
|
245
237
|
}
|
|
246
|
-
return elements.filter(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
return true;
|
|
251
|
-
});
|
|
238
|
+
return elements.filter(
|
|
239
|
+
(element) => isUngroupedRadio(element) ? placeholder.has(element) : true
|
|
240
|
+
);
|
|
252
241
|
}
|
|
253
242
|
function sortByTabIndex(elements) {
|
|
254
243
|
const ordered = [];
|
|
255
244
|
const natural = [];
|
|
256
245
|
for (let i = 0, l = elements.length; i < l; i++) {
|
|
257
246
|
const element = elements[i];
|
|
258
|
-
if (
|
|
259
|
-
|
|
247
|
+
if (element) {
|
|
248
|
+
const target = getTabIndex(element) > 0 ? ordered : natural;
|
|
249
|
+
target[target.length] = element;
|
|
260
250
|
}
|
|
261
|
-
const target = getTabIndex(element) > 0 ? ordered : natural;
|
|
262
|
-
target[target.length] = element;
|
|
263
251
|
}
|
|
264
252
|
ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b));
|
|
265
253
|
let count = 0;
|
|
@@ -416,11 +404,7 @@ var RovingTabIndex = class {
|
|
|
416
404
|
return;
|
|
417
405
|
}
|
|
418
406
|
const isFocusable22 = this.#focusables.has(target);
|
|
419
|
-
|
|
420
|
-
this.#update(null);
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
isFocusable22 && this.#update(target);
|
|
407
|
+
this.#options.noMemory && !isFocusable22 ? this.#update(null) : isFocusable22 && this.#update(target);
|
|
424
408
|
};
|
|
425
409
|
#onKeyDown = (event) => {
|
|
426
410
|
if (!event.composedPath().includes(this.#container)) {
|
|
@@ -453,8 +437,7 @@ var RovingTabIndex = class {
|
|
|
453
437
|
}
|
|
454
438
|
event.preventDefault();
|
|
455
439
|
const currentIndex = current.indexOf(active);
|
|
456
|
-
let
|
|
457
|
-
let newIndex = currentIndex;
|
|
440
|
+
let newIndex;
|
|
458
441
|
let target = current;
|
|
459
442
|
switch (key) {
|
|
460
443
|
case "End":
|
|
@@ -464,15 +447,17 @@ var RovingTabIndex = class {
|
|
|
464
447
|
newIndex = 0;
|
|
465
448
|
break;
|
|
466
449
|
case "ArrowLeft":
|
|
467
|
-
case "ArrowUp":
|
|
468
|
-
rawIndex = currentIndex - 1;
|
|
450
|
+
case "ArrowUp": {
|
|
451
|
+
const rawIndex = currentIndex - 1;
|
|
469
452
|
newIndex = wrap ? rawIndex : Math.max(rawIndex, 0);
|
|
470
453
|
break;
|
|
454
|
+
}
|
|
471
455
|
case "ArrowRight":
|
|
472
|
-
case "ArrowDown":
|
|
473
|
-
rawIndex = currentIndex + 1;
|
|
456
|
+
case "ArrowDown": {
|
|
457
|
+
const rawIndex = currentIndex + 1;
|
|
474
458
|
newIndex = wrap ? rawIndex % current.length : Math.min(rawIndex, current.length - 1);
|
|
475
459
|
break;
|
|
460
|
+
}
|
|
476
461
|
default: {
|
|
477
462
|
target = this.#focusablesByFirstChar.get(key.toUpperCase()) ?? [];
|
|
478
463
|
const foundIndex = target.findIndex(
|
|
@@ -487,15 +472,14 @@ var RovingTabIndex = class {
|
|
|
487
472
|
#update(active) {
|
|
488
473
|
const current = new Set(this.#getFocusables());
|
|
489
474
|
for (const focusable of this.#focusables) {
|
|
490
|
-
if (current.has(focusable)) {
|
|
491
|
-
|
|
475
|
+
if (!current.has(focusable)) {
|
|
476
|
+
focusable.isConnected && restoreAttributes2([focusable]);
|
|
477
|
+
this.#focusables.delete(focusable);
|
|
478
|
+
this.#focusablesByFirstChar.forEach((focusables) => {
|
|
479
|
+
const index = focusables.indexOf(focusable);
|
|
480
|
+
index >= 0 && focusables.splice(index, 1);
|
|
481
|
+
});
|
|
492
482
|
}
|
|
493
|
-
focusable.isConnected && restoreAttributes2([focusable]);
|
|
494
|
-
this.#focusables.delete(focusable);
|
|
495
|
-
this.#focusablesByFirstChar.forEach((focusables) => {
|
|
496
|
-
const index = focusables.indexOf(focusable);
|
|
497
|
-
index >= 0 && focusables.splice(index, 1);
|
|
498
|
-
});
|
|
499
483
|
}
|
|
500
484
|
const { navigationOnly, noStart, typeahead } = this.#options;
|
|
501
485
|
for (const focusable of current) {
|
|
@@ -528,18 +512,17 @@ var RovingTabIndex = class {
|
|
|
528
512
|
this.#focusablesByFirstChar.set(key, focusables);
|
|
529
513
|
});
|
|
530
514
|
}
|
|
531
|
-
if (navigationOnly) {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
515
|
+
if (!navigationOnly) {
|
|
516
|
+
if (active && this.#focusables.has(active)) {
|
|
517
|
+
this.#focusables.forEach((focusable) => {
|
|
518
|
+
focusable.setAttribute("tabindex", focusable === active ? "0" : "-1");
|
|
519
|
+
});
|
|
520
|
+
} else {
|
|
521
|
+
[...this.#focusables].forEach((focusable, i) => {
|
|
522
|
+
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
523
|
+
});
|
|
524
|
+
}
|
|
539
525
|
}
|
|
540
|
-
[...this.#focusables].forEach((focusable, i) => {
|
|
541
|
-
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
542
|
-
});
|
|
543
526
|
}
|
|
544
527
|
#createSelectorFilter() {
|
|
545
528
|
const { selector } = this.#options;
|
|
@@ -785,11 +768,10 @@ var Disclosure = class _Disclosure {
|
|
|
785
768
|
animation.addEventListener(
|
|
786
769
|
"finish",
|
|
787
770
|
() => {
|
|
788
|
-
if (binding?.animation
|
|
789
|
-
|
|
771
|
+
if (binding?.animation === animation) {
|
|
772
|
+
this.#onAnimationFinish(content);
|
|
773
|
+
cleanup();
|
|
790
774
|
}
|
|
791
|
-
this.#onAnimationFinish(content);
|
|
792
|
-
cleanup();
|
|
793
775
|
},
|
|
794
776
|
{ once: true, signal }
|
|
795
777
|
);
|
|
@@ -845,7 +827,7 @@ function waitAnimationFinish(animation) {
|
|
|
845
827
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
846
828
|
* Using the <details> and <summary> element.
|
|
847
829
|
*
|
|
848
|
-
* @version 1.3.
|
|
830
|
+
* @version 1.3.11
|
|
849
831
|
* @author Yusuke Kamiyamane
|
|
850
832
|
* @license MIT
|
|
851
833
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -857,7 +839,7 @@ function waitAnimationFinish(animation) {
|
|
|
857
839
|
(**
|
|
858
840
|
* Attributes Utils
|
|
859
841
|
*
|
|
860
|
-
* @version 1.1.
|
|
842
|
+
* @version 1.1.2
|
|
861
843
|
* @author Yusuke Kamiyamane
|
|
862
844
|
* @license MIT
|
|
863
845
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -870,7 +852,7 @@ function waitAnimationFinish(animation) {
|
|
|
870
852
|
* Lightweight roving tabindex utility with fully focus management.
|
|
871
853
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
872
854
|
*
|
|
873
|
-
* @version 3.0.
|
|
855
|
+
* @version 3.0.2
|
|
874
856
|
* @author Yusuke Kamiyamane
|
|
875
857
|
* @license MIT
|
|
876
858
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -882,7 +864,7 @@ function waitAnimationFinish(animation) {
|
|
|
882
864
|
(**
|
|
883
865
|
* Attributes Utils
|
|
884
866
|
*
|
|
885
|
-
* @version 1.1.
|
|
867
|
+
* @version 1.1.2
|
|
886
868
|
* @author Yusuke Kamiyamane
|
|
887
869
|
* @license MIT
|
|
888
870
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -895,7 +877,7 @@ function waitAnimationFinish(animation) {
|
|
|
895
877
|
* High-precision focus management utility with full composed tree support.
|
|
896
878
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
897
879
|
*
|
|
898
|
-
* @version 4.3.
|
|
880
|
+
* @version 4.3.3
|
|
899
881
|
* @author Yusuke Kamiyamane
|
|
900
882
|
* @license MIT
|
|
901
883
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -26,13 +26,13 @@ function saveAttributes(elements, attributes) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// node_modules/@y14e/roving-tabindex/dist/index.js
|
|
29
|
-
var
|
|
30
|
-
var
|
|
29
|
+
var DEFAULT_PARSER = (value) => value.split(/\s+/);
|
|
30
|
+
var DEFAULT_SERIALIZER = (tokens) => tokens.join(" ");
|
|
31
31
|
function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
32
32
|
const {
|
|
33
33
|
caseInsensitive = false,
|
|
34
|
-
parse =
|
|
35
|
-
serialize =
|
|
34
|
+
parse = DEFAULT_PARSER,
|
|
35
|
+
serialize = DEFAULT_SERIALIZER
|
|
36
36
|
} = options;
|
|
37
37
|
const value = element.getAttribute(attribute)?.trim();
|
|
38
38
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
@@ -42,11 +42,11 @@ function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
|
42
42
|
tokens.push(token);
|
|
43
43
|
element.setAttribute(attribute, serialize(tokens));
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
} else {
|
|
46
|
+
const set = new Set(tokens);
|
|
47
|
+
set.add(token);
|
|
48
|
+
element.setAttribute(attribute, serialize([...set]));
|
|
46
49
|
}
|
|
47
|
-
const set = new Set(tokens);
|
|
48
|
-
set.add(token);
|
|
49
|
-
element.setAttribute(attribute, serialize([...set]));
|
|
50
50
|
}
|
|
51
51
|
var snapshots2 = /* @__PURE__ */ new WeakMap();
|
|
52
52
|
function restoreAttributes2(elements) {
|
|
@@ -113,21 +113,16 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
113
113
|
const elements = [];
|
|
114
114
|
if (composed || include) {
|
|
115
115
|
let traverse2 = function(node) {
|
|
116
|
-
if (node instanceof Element) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
elements[elements.length] = node;
|
|
122
|
-
}
|
|
116
|
+
if (!(node instanceof Element)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (isFocusable(node, { skipNegativeTabIndexCheck, skipVisibilityCheck }) || include?.(node)) {
|
|
120
|
+
elements[elements.length] = node;
|
|
123
121
|
}
|
|
124
122
|
const children = getComposedChildren(node);
|
|
125
123
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
126
124
|
const child = children[i];
|
|
127
|
-
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
traverse2(child);
|
|
125
|
+
child && traverse2(child);
|
|
131
126
|
}
|
|
132
127
|
};
|
|
133
128
|
traverse2(container);
|
|
@@ -135,10 +130,7 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
135
130
|
const candidates = container.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
136
131
|
for (let i = 0, l = candidates.length; i < l; i++) {
|
|
137
132
|
const candidate = candidates[i];
|
|
138
|
-
if (
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (isFocusable(candidate, {
|
|
133
|
+
if (candidate && isFocusable(candidate, {
|
|
142
134
|
skipNegativeTabIndexCheck,
|
|
143
135
|
skipVisibilityCheck
|
|
144
136
|
})) {
|
|
@@ -241,23 +233,19 @@ function normalizeRadioGroup(elements) {
|
|
|
241
233
|
for (const group of map.values()) {
|
|
242
234
|
placeholder.add(group.find((radio) => radio.checked) ?? group[0]);
|
|
243
235
|
}
|
|
244
|
-
return elements.filter(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
return true;
|
|
249
|
-
});
|
|
236
|
+
return elements.filter(
|
|
237
|
+
(element) => isUngroupedRadio(element) ? placeholder.has(element) : true
|
|
238
|
+
);
|
|
250
239
|
}
|
|
251
240
|
function sortByTabIndex(elements) {
|
|
252
241
|
const ordered = [];
|
|
253
242
|
const natural = [];
|
|
254
243
|
for (let i = 0, l = elements.length; i < l; i++) {
|
|
255
244
|
const element = elements[i];
|
|
256
|
-
if (
|
|
257
|
-
|
|
245
|
+
if (element) {
|
|
246
|
+
const target = getTabIndex(element) > 0 ? ordered : natural;
|
|
247
|
+
target[target.length] = element;
|
|
258
248
|
}
|
|
259
|
-
const target = getTabIndex(element) > 0 ? ordered : natural;
|
|
260
|
-
target[target.length] = element;
|
|
261
249
|
}
|
|
262
250
|
ordered.sort((a, b) => getTabIndex(a) - getTabIndex(b));
|
|
263
251
|
let count = 0;
|
|
@@ -414,11 +402,7 @@ var RovingTabIndex = class {
|
|
|
414
402
|
return;
|
|
415
403
|
}
|
|
416
404
|
const isFocusable22 = this.#focusables.has(target);
|
|
417
|
-
|
|
418
|
-
this.#update(null);
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
isFocusable22 && this.#update(target);
|
|
405
|
+
this.#options.noMemory && !isFocusable22 ? this.#update(null) : isFocusable22 && this.#update(target);
|
|
422
406
|
};
|
|
423
407
|
#onKeyDown = (event) => {
|
|
424
408
|
if (!event.composedPath().includes(this.#container)) {
|
|
@@ -451,8 +435,7 @@ var RovingTabIndex = class {
|
|
|
451
435
|
}
|
|
452
436
|
event.preventDefault();
|
|
453
437
|
const currentIndex = current.indexOf(active);
|
|
454
|
-
let
|
|
455
|
-
let newIndex = currentIndex;
|
|
438
|
+
let newIndex;
|
|
456
439
|
let target = current;
|
|
457
440
|
switch (key) {
|
|
458
441
|
case "End":
|
|
@@ -462,15 +445,17 @@ var RovingTabIndex = class {
|
|
|
462
445
|
newIndex = 0;
|
|
463
446
|
break;
|
|
464
447
|
case "ArrowLeft":
|
|
465
|
-
case "ArrowUp":
|
|
466
|
-
rawIndex = currentIndex - 1;
|
|
448
|
+
case "ArrowUp": {
|
|
449
|
+
const rawIndex = currentIndex - 1;
|
|
467
450
|
newIndex = wrap ? rawIndex : Math.max(rawIndex, 0);
|
|
468
451
|
break;
|
|
452
|
+
}
|
|
469
453
|
case "ArrowRight":
|
|
470
|
-
case "ArrowDown":
|
|
471
|
-
rawIndex = currentIndex + 1;
|
|
454
|
+
case "ArrowDown": {
|
|
455
|
+
const rawIndex = currentIndex + 1;
|
|
472
456
|
newIndex = wrap ? rawIndex % current.length : Math.min(rawIndex, current.length - 1);
|
|
473
457
|
break;
|
|
458
|
+
}
|
|
474
459
|
default: {
|
|
475
460
|
target = this.#focusablesByFirstChar.get(key.toUpperCase()) ?? [];
|
|
476
461
|
const foundIndex = target.findIndex(
|
|
@@ -485,15 +470,14 @@ var RovingTabIndex = class {
|
|
|
485
470
|
#update(active) {
|
|
486
471
|
const current = new Set(this.#getFocusables());
|
|
487
472
|
for (const focusable of this.#focusables) {
|
|
488
|
-
if (current.has(focusable)) {
|
|
489
|
-
|
|
473
|
+
if (!current.has(focusable)) {
|
|
474
|
+
focusable.isConnected && restoreAttributes2([focusable]);
|
|
475
|
+
this.#focusables.delete(focusable);
|
|
476
|
+
this.#focusablesByFirstChar.forEach((focusables) => {
|
|
477
|
+
const index = focusables.indexOf(focusable);
|
|
478
|
+
index >= 0 && focusables.splice(index, 1);
|
|
479
|
+
});
|
|
490
480
|
}
|
|
491
|
-
focusable.isConnected && restoreAttributes2([focusable]);
|
|
492
|
-
this.#focusables.delete(focusable);
|
|
493
|
-
this.#focusablesByFirstChar.forEach((focusables) => {
|
|
494
|
-
const index = focusables.indexOf(focusable);
|
|
495
|
-
index >= 0 && focusables.splice(index, 1);
|
|
496
|
-
});
|
|
497
481
|
}
|
|
498
482
|
const { navigationOnly, noStart, typeahead } = this.#options;
|
|
499
483
|
for (const focusable of current) {
|
|
@@ -526,18 +510,17 @@ var RovingTabIndex = class {
|
|
|
526
510
|
this.#focusablesByFirstChar.set(key, focusables);
|
|
527
511
|
});
|
|
528
512
|
}
|
|
529
|
-
if (navigationOnly) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
513
|
+
if (!navigationOnly) {
|
|
514
|
+
if (active && this.#focusables.has(active)) {
|
|
515
|
+
this.#focusables.forEach((focusable) => {
|
|
516
|
+
focusable.setAttribute("tabindex", focusable === active ? "0" : "-1");
|
|
517
|
+
});
|
|
518
|
+
} else {
|
|
519
|
+
[...this.#focusables].forEach((focusable, i) => {
|
|
520
|
+
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
521
|
+
});
|
|
522
|
+
}
|
|
537
523
|
}
|
|
538
|
-
[...this.#focusables].forEach((focusable, i) => {
|
|
539
|
-
focusable.setAttribute("tabindex", i || noStart ? "-1" : "0");
|
|
540
|
-
});
|
|
541
524
|
}
|
|
542
525
|
#createSelectorFilter() {
|
|
543
526
|
const { selector } = this.#options;
|
|
@@ -783,11 +766,10 @@ var Disclosure = class _Disclosure {
|
|
|
783
766
|
animation.addEventListener(
|
|
784
767
|
"finish",
|
|
785
768
|
() => {
|
|
786
|
-
if (binding?.animation
|
|
787
|
-
|
|
769
|
+
if (binding?.animation === animation) {
|
|
770
|
+
this.#onAnimationFinish(content);
|
|
771
|
+
cleanup();
|
|
788
772
|
}
|
|
789
|
-
this.#onAnimationFinish(content);
|
|
790
|
-
cleanup();
|
|
791
773
|
},
|
|
792
774
|
{ once: true, signal }
|
|
793
775
|
);
|
|
@@ -843,7 +825,7 @@ function waitAnimationFinish(animation) {
|
|
|
843
825
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
844
826
|
* Using the <details> and <summary> element.
|
|
845
827
|
*
|
|
846
|
-
* @version 1.3.
|
|
828
|
+
* @version 1.3.11
|
|
847
829
|
* @author Yusuke Kamiyamane
|
|
848
830
|
* @license MIT
|
|
849
831
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -855,7 +837,7 @@ function waitAnimationFinish(animation) {
|
|
|
855
837
|
(**
|
|
856
838
|
* Attributes Utils
|
|
857
839
|
*
|
|
858
|
-
* @version 1.1.
|
|
840
|
+
* @version 1.1.2
|
|
859
841
|
* @author Yusuke Kamiyamane
|
|
860
842
|
* @license MIT
|
|
861
843
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -868,7 +850,7 @@ function waitAnimationFinish(animation) {
|
|
|
868
850
|
* Lightweight roving tabindex utility with fully focus management.
|
|
869
851
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
870
852
|
*
|
|
871
|
-
* @version 3.0.
|
|
853
|
+
* @version 3.0.2
|
|
872
854
|
* @author Yusuke Kamiyamane
|
|
873
855
|
* @license MIT
|
|
874
856
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -880,7 +862,7 @@ function waitAnimationFinish(animation) {
|
|
|
880
862
|
(**
|
|
881
863
|
* Attributes Utils
|
|
882
864
|
*
|
|
883
|
-
* @version 1.1.
|
|
865
|
+
* @version 1.1.2
|
|
884
866
|
* @author Yusuke Kamiyamane
|
|
885
867
|
* @license MIT
|
|
886
868
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -893,7 +875,7 @@ function waitAnimationFinish(animation) {
|
|
|
893
875
|
* High-precision focus management utility with full composed tree support.
|
|
894
876
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
895
877
|
*
|
|
896
|
-
* @version 4.3.
|
|
878
|
+
* @version 4.3.3
|
|
897
879
|
* @author Yusuke Kamiyamane
|
|
898
880
|
* @license MIT
|
|
899
881
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/disclosure",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/y14e/disclosure#readme",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@y14e/attributes-utils": "^1.1.
|
|
47
|
-
"@y14e/roving-tabindex": "^3.0.
|
|
46
|
+
"@y14e/attributes-utils": "^1.1.2",
|
|
47
|
+
"@y14e/roving-tabindex": "^3.0.2",
|
|
48
48
|
"bun-types": "latest",
|
|
49
49
|
"tsup": "^8.0.0",
|
|
50
50
|
"typescript": "^5.6.0",
|