@y14e/disclosure-css 1.3.2 → 1.3.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 CHANGED
@@ -10,14 +10,14 @@ npm i @y14e/disclosure-css
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Disclosure from '@y14e/disclosure-css@1.3.2';
13
+ import Disclosure from '@y14e/disclosure-css@1.3.4';
14
14
 
15
15
  // CDNs
16
- import Disclosure from 'https://esm.sh/@y14e/disclosure-css@1.3.2';
16
+ import Disclosure from 'https://esm.sh/@y14e/disclosure-css@1.3.4';
17
17
  // or
18
- import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@1.3.2/+esm';
18
+ import Disclosure from 'https://cdn.jsdelivr.net/npm/@y14e/disclosure-css@1.3.4/+esm';
19
19
  // or
20
- import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure-css@1.3.2';
20
+ import Disclosure from 'https://esm.unpkg.com/@y14e/disclosure-css@1.3.4';
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 !== void 0) {
353
+ if (direction) {
354
354
  Object.assign(settings, { direction });
355
355
  }
356
- if (selector !== void 0) {
356
+ if (selector) {
357
357
  Object.assign(settings, { selector });
358
358
  }
359
359
  const roving = new RovingTabIndex(container, settings);
@@ -634,16 +634,15 @@ var Disclosure = class {
634
634
  this.#rootElement.removeAttribute("data-disclosure-initialized");
635
635
  }
636
636
  #initialize() {
637
- this.#summaryElements.forEach((summary) => {
638
- if (!summary) {
639
- return;
640
- }
641
- if (!isFocusable2(summary)) {
642
- saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
643
- summary.setAttribute("aria-disabled", "true");
644
- summary.setAttribute("tabindex", "-1");
645
- summary.style.setProperty("pointer-events", "none");
646
- }
637
+ saveAttributes(this.#summaryElements, [
638
+ "aria-disabled",
639
+ "style",
640
+ "tabindex"
641
+ ]);
642
+ this.#summaryElements.filter((summary) => !isFocusable2(summary)).forEach((summary) => {
643
+ summary.setAttribute("aria-disabled", "true");
644
+ summary.setAttribute("tabindex", "-1");
645
+ summary.style.setProperty("pointer-events", "none");
647
646
  });
648
647
  this.#cleanupRovingTabIndex = createRovingTabIndex(this.#rootElement, {
649
648
  direction: "vertical",
@@ -670,7 +669,7 @@ function isFocusable2(element) {
670
669
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
671
670
  * Using the <details> and <summary> element.
672
671
  *
673
- * @version 1.3.2
672
+ * @version 1.3.4
674
673
  * @author Yusuke Kamiyamane
675
674
  * @license MIT
676
675
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -695,7 +694,7 @@ function isFocusable2(element) {
695
694
  * Lightweight roving tabindex utility with fully focus management.
696
695
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
697
696
  *
698
- * @version 2.0.3
697
+ * @version 2.0.4
699
698
  * @author Yusuke Kamiyamane
700
699
  * @license MIT
701
700
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 1.3.2
6
+ * @version 1.3.4
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
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
4
4
  * Using the <details> and <summary> element.
5
5
  *
6
- * @version 1.3.2
6
+ * @version 1.3.4
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
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 !== void 0) {
351
+ if (direction) {
352
352
  Object.assign(settings, { direction });
353
353
  }
354
- if (selector !== void 0) {
354
+ if (selector) {
355
355
  Object.assign(settings, { selector });
356
356
  }
357
357
  const roving = new RovingTabIndex(container, settings);
@@ -632,16 +632,15 @@ var Disclosure = class {
632
632
  this.#rootElement.removeAttribute("data-disclosure-initialized");
633
633
  }
634
634
  #initialize() {
635
- this.#summaryElements.forEach((summary) => {
636
- if (!summary) {
637
- return;
638
- }
639
- if (!isFocusable2(summary)) {
640
- saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
641
- summary.setAttribute("aria-disabled", "true");
642
- summary.setAttribute("tabindex", "-1");
643
- summary.style.setProperty("pointer-events", "none");
644
- }
635
+ saveAttributes(this.#summaryElements, [
636
+ "aria-disabled",
637
+ "style",
638
+ "tabindex"
639
+ ]);
640
+ this.#summaryElements.filter((summary) => !isFocusable2(summary)).forEach((summary) => {
641
+ summary.setAttribute("aria-disabled", "true");
642
+ summary.setAttribute("tabindex", "-1");
643
+ summary.style.setProperty("pointer-events", "none");
645
644
  });
646
645
  this.#cleanupRovingTabIndex = createRovingTabIndex(this.#rootElement, {
647
646
  direction: "vertical",
@@ -668,7 +667,7 @@ function isFocusable2(element) {
668
667
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
669
668
  * Using the <details> and <summary> element.
670
669
  *
671
- * @version 1.3.2
670
+ * @version 1.3.4
672
671
  * @author Yusuke Kamiyamane
673
672
  * @license MIT
674
673
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -693,7 +692,7 @@ function isFocusable2(element) {
693
692
  * Lightweight roving tabindex utility with fully focus management.
694
693
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
695
694
  *
696
- * @version 2.0.3
695
+ * @version 2.0.4
697
696
  * @author Yusuke Kamiyamane
698
697
  * @license MIT
699
698
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/disclosure-css",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
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-css#readme",
45
45
  "devDependencies": {
46
46
  "@y14e/attributes-utils": "^1.1.0",
47
- "@y14e/roving-tabindex": "^2.0.3",
47
+ "@y14e/roving-tabindex": "^2.0.4",
48
48
  "bun-types": "latest",
49
49
  "tsup": "^8.0.0",
50
50
  "typescript": "^5.6.0"