@y14e/disclosure-css 1.2.2 → 1.2.4
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 +1 -1
- package/dist/index.cjs +5 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -7
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -94,12 +94,11 @@ var Disclosure = class {
|
|
|
94
94
|
#initialize() {
|
|
95
95
|
this.#controller = new AbortController();
|
|
96
96
|
const { signal } = this.#controller;
|
|
97
|
-
this.#
|
|
98
|
-
const summary = this.#summaryElements[i];
|
|
97
|
+
this.#summaryElements.forEach((summary) => {
|
|
99
98
|
if (!summary) {
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
|
-
if (!isFocusable(
|
|
101
|
+
if (!isFocusable(summary)) {
|
|
103
102
|
summary.setAttribute("aria-disabled", "true");
|
|
104
103
|
summary.setAttribute("tabindex", "-1");
|
|
105
104
|
summary.style.setProperty("pointer-events", "none");
|
|
@@ -113,13 +112,12 @@ var Disclosure = class {
|
|
|
113
112
|
if (!["End", "Home", "ArrowUp", "ArrowDown"].includes(key)) {
|
|
114
113
|
return;
|
|
115
114
|
}
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
event.stopPropagation();
|
|
118
115
|
const focusables = this.#summaryElements.filter(isFocusable);
|
|
119
116
|
const active = getActiveElement();
|
|
120
117
|
if (!(active instanceof HTMLElement)) {
|
|
121
118
|
return;
|
|
122
119
|
}
|
|
120
|
+
event.preventDefault();
|
|
123
121
|
const currentIndex = focusables.indexOf(active);
|
|
124
122
|
let newIndex = currentIndex;
|
|
125
123
|
switch (key) {
|
|
@@ -158,11 +156,11 @@ function isFocusable(element) {
|
|
|
158
156
|
return element.tabIndex >= 0;
|
|
159
157
|
}
|
|
160
158
|
/**
|
|
161
|
-
* Disclosure (CSS)
|
|
159
|
+
* Disclosure (CSS Animation)
|
|
162
160
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
163
161
|
* Using the <details> and <summary> element.
|
|
164
162
|
*
|
|
165
|
-
* @version 1.2.
|
|
163
|
+
* @version 1.2.4
|
|
166
164
|
* @author Yusuke Kamiyamane
|
|
167
165
|
* @license MIT
|
|
168
166
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Disclosure (CSS)
|
|
2
|
+
* Disclosure (CSS Animation)
|
|
3
3
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
4
4
|
* Using the <details> and <summary> element.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.2.
|
|
6
|
+
* @version 1.2.4
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Disclosure (CSS)
|
|
2
|
+
* Disclosure (CSS Animation)
|
|
3
3
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
4
4
|
* Using the <details> and <summary> element.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.2.
|
|
6
|
+
* @version 1.2.4
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -92,12 +92,11 @@ var Disclosure = class {
|
|
|
92
92
|
#initialize() {
|
|
93
93
|
this.#controller = new AbortController();
|
|
94
94
|
const { signal } = this.#controller;
|
|
95
|
-
this.#
|
|
96
|
-
const summary = this.#summaryElements[i];
|
|
95
|
+
this.#summaryElements.forEach((summary) => {
|
|
97
96
|
if (!summary) {
|
|
98
97
|
return;
|
|
99
98
|
}
|
|
100
|
-
if (!isFocusable(
|
|
99
|
+
if (!isFocusable(summary)) {
|
|
101
100
|
summary.setAttribute("aria-disabled", "true");
|
|
102
101
|
summary.setAttribute("tabindex", "-1");
|
|
103
102
|
summary.style.setProperty("pointer-events", "none");
|
|
@@ -111,13 +110,12 @@ var Disclosure = class {
|
|
|
111
110
|
if (!["End", "Home", "ArrowUp", "ArrowDown"].includes(key)) {
|
|
112
111
|
return;
|
|
113
112
|
}
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
event.stopPropagation();
|
|
116
113
|
const focusables = this.#summaryElements.filter(isFocusable);
|
|
117
114
|
const active = getActiveElement();
|
|
118
115
|
if (!(active instanceof HTMLElement)) {
|
|
119
116
|
return;
|
|
120
117
|
}
|
|
118
|
+
event.preventDefault();
|
|
121
119
|
const currentIndex = focusables.indexOf(active);
|
|
122
120
|
let newIndex = currentIndex;
|
|
123
121
|
switch (key) {
|
|
@@ -156,11 +154,11 @@ function isFocusable(element) {
|
|
|
156
154
|
return element.tabIndex >= 0;
|
|
157
155
|
}
|
|
158
156
|
/**
|
|
159
|
-
* Disclosure (CSS)
|
|
157
|
+
* Disclosure (CSS Animation)
|
|
160
158
|
* WAI-ARIA compliant disclosure pattern implementation in TypeScript.
|
|
161
159
|
* Using the <details> and <summary> element.
|
|
162
160
|
*
|
|
163
|
-
* @version 1.2.
|
|
161
|
+
* @version 1.2.4
|
|
164
162
|
* @author Yusuke Kamiyamane
|
|
165
163
|
* @license MIT
|
|
166
164
|
* @copyright Copyright (c) Yusuke Kamiyamane
|