@y14e/disclosure 1.3.5 → 1.3.6
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 +10 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -6
- package/package.json +2 -2
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.6';
|
|
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.6';
|
|
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.6/+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.6';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -335,7 +335,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
335
335
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
336
336
|
navigationOnly = false;
|
|
337
337
|
}
|
|
338
|
-
if (typeof selector !== "undefined" && typeof selector !== "string") {
|
|
338
|
+
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
339
339
|
console.warn(
|
|
340
340
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
341
341
|
);
|
|
@@ -350,10 +350,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
350
350
|
wrap = false;
|
|
351
351
|
}
|
|
352
352
|
const settings = { navigationOnly, typeahead, wrap };
|
|
353
|
-
if (direction
|
|
353
|
+
if (direction) {
|
|
354
354
|
Object.assign(settings, { direction });
|
|
355
355
|
}
|
|
356
|
-
if (selector
|
|
356
|
+
if (selector) {
|
|
357
357
|
Object.assign(settings, { selector });
|
|
358
358
|
}
|
|
359
359
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -665,6 +665,11 @@ var Disclosure = class _Disclosure {
|
|
|
665
665
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
666
666
|
}
|
|
667
667
|
#initialize() {
|
|
668
|
+
saveAttributes(this.#summaryElements, [
|
|
669
|
+
"aria-disabled",
|
|
670
|
+
"style",
|
|
671
|
+
"tabindex"
|
|
672
|
+
]);
|
|
668
673
|
this.#eventController = new AbortController();
|
|
669
674
|
const { signal } = this.#eventController;
|
|
670
675
|
this.#detailsElements.forEach((details, i) => {
|
|
@@ -681,7 +686,6 @@ var Disclosure = class _Disclosure {
|
|
|
681
686
|
return;
|
|
682
687
|
}
|
|
683
688
|
if (!isFocusable2(summary)) {
|
|
684
|
-
saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
|
|
685
689
|
summary.setAttribute("aria-disabled", "true");
|
|
686
690
|
summary.setAttribute("tabindex", "-1");
|
|
687
691
|
summary.style.setProperty("pointer-events", "none");
|
|
@@ -814,7 +818,7 @@ function waitAnimationFinish(animation) {
|
|
|
814
818
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
815
819
|
* Using the <details> and <summary> element.
|
|
816
820
|
*
|
|
817
|
-
* @version 1.3.
|
|
821
|
+
* @version 1.3.6
|
|
818
822
|
* @author Yusuke Kamiyamane
|
|
819
823
|
* @license MIT
|
|
820
824
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -839,7 +843,7 @@ function waitAnimationFinish(animation) {
|
|
|
839
843
|
* Lightweight roving tabindex utility with fully focus management.
|
|
840
844
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
841
845
|
*
|
|
842
|
-
* @version 2.0.
|
|
846
|
+
* @version 2.0.4
|
|
843
847
|
* @author Yusuke Kamiyamane
|
|
844
848
|
* @license MIT
|
|
845
849
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -333,7 +333,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
333
333
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
334
334
|
navigationOnly = false;
|
|
335
335
|
}
|
|
336
|
-
if (typeof selector !== "undefined" && typeof selector !== "string") {
|
|
336
|
+
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
337
337
|
console.warn(
|
|
338
338
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
339
339
|
);
|
|
@@ -348,10 +348,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
348
348
|
wrap = false;
|
|
349
349
|
}
|
|
350
350
|
const settings = { navigationOnly, typeahead, wrap };
|
|
351
|
-
if (direction
|
|
351
|
+
if (direction) {
|
|
352
352
|
Object.assign(settings, { direction });
|
|
353
353
|
}
|
|
354
|
-
if (selector
|
|
354
|
+
if (selector) {
|
|
355
355
|
Object.assign(settings, { selector });
|
|
356
356
|
}
|
|
357
357
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -663,6 +663,11 @@ var Disclosure = class _Disclosure {
|
|
|
663
663
|
this.#rootElement.removeAttribute("data-disclosure-initialized");
|
|
664
664
|
}
|
|
665
665
|
#initialize() {
|
|
666
|
+
saveAttributes(this.#summaryElements, [
|
|
667
|
+
"aria-disabled",
|
|
668
|
+
"style",
|
|
669
|
+
"tabindex"
|
|
670
|
+
]);
|
|
666
671
|
this.#eventController = new AbortController();
|
|
667
672
|
const { signal } = this.#eventController;
|
|
668
673
|
this.#detailsElements.forEach((details, i) => {
|
|
@@ -679,7 +684,6 @@ var Disclosure = class _Disclosure {
|
|
|
679
684
|
return;
|
|
680
685
|
}
|
|
681
686
|
if (!isFocusable2(summary)) {
|
|
682
|
-
saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
|
|
683
687
|
summary.setAttribute("aria-disabled", "true");
|
|
684
688
|
summary.setAttribute("tabindex", "-1");
|
|
685
689
|
summary.style.setProperty("pointer-events", "none");
|
|
@@ -812,7 +816,7 @@ function waitAnimationFinish(animation) {
|
|
|
812
816
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
813
817
|
* Using the <details> and <summary> element.
|
|
814
818
|
*
|
|
815
|
-
* @version 1.3.
|
|
819
|
+
* @version 1.3.6
|
|
816
820
|
* @author Yusuke Kamiyamane
|
|
817
821
|
* @license MIT
|
|
818
822
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -837,7 +841,7 @@ function waitAnimationFinish(animation) {
|
|
|
837
841
|
* Lightweight roving tabindex utility with fully focus management.
|
|
838
842
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
839
843
|
*
|
|
840
|
-
* @version 2.0.
|
|
844
|
+
* @version 2.0.4
|
|
841
845
|
* @author Yusuke Kamiyamane
|
|
842
846
|
* @license MIT
|
|
843
847
|
* @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.6",
|
|
4
4
|
"description": "WAI-ARIA compliant disclosure pattern implementation in TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"homepage": "https://github.com/y14e/disclosure#readme",
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@y14e/attributes-utils": "^1.1.0",
|
|
47
|
-
"@y14e/roving-tabindex": "^2.0.
|
|
47
|
+
"@y14e/roving-tabindex": "^2.0.4",
|
|
48
48
|
"bun-types": "latest",
|
|
49
49
|
"tsup": "^8.0.0",
|
|
50
50
|
"typescript": "^5.6.0",
|