@y14e/disclosure-css 1.3.2 → 1.3.3

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.3';
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.3';
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.3/+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.3';
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,12 +634,16 @@ var Disclosure = class {
634
634
  this.#rootElement.removeAttribute("data-disclosure-initialized");
635
635
  }
636
636
  #initialize() {
637
+ saveAttributes(this.#summaryElements, [
638
+ "aria-disabled",
639
+ "style",
640
+ "tabindex"
641
+ ]);
637
642
  this.#summaryElements.forEach((summary) => {
638
643
  if (!summary) {
639
644
  return;
640
645
  }
641
646
  if (!isFocusable2(summary)) {
642
- saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
643
647
  summary.setAttribute("aria-disabled", "true");
644
648
  summary.setAttribute("tabindex", "-1");
645
649
  summary.style.setProperty("pointer-events", "none");
@@ -670,7 +674,7 @@ function isFocusable2(element) {
670
674
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
671
675
  * Using the <details> and <summary> element.
672
676
  *
673
- * @version 1.3.2
677
+ * @version 1.3.3
674
678
  * @author Yusuke Kamiyamane
675
679
  * @license MIT
676
680
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -695,7 +699,7 @@ function isFocusable2(element) {
695
699
  * Lightweight roving tabindex utility with fully focus management.
696
700
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
697
701
  *
698
- * @version 2.0.3
702
+ * @version 2.0.4
699
703
  * @author Yusuke Kamiyamane
700
704
  * @license MIT
701
705
  * @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.3
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.3
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,12 +632,16 @@ var Disclosure = class {
632
632
  this.#rootElement.removeAttribute("data-disclosure-initialized");
633
633
  }
634
634
  #initialize() {
635
+ saveAttributes(this.#summaryElements, [
636
+ "aria-disabled",
637
+ "style",
638
+ "tabindex"
639
+ ]);
635
640
  this.#summaryElements.forEach((summary) => {
636
641
  if (!summary) {
637
642
  return;
638
643
  }
639
644
  if (!isFocusable2(summary)) {
640
- saveAttributes([summary], ["aria-disabled", "style", "tabindex"]);
641
645
  summary.setAttribute("aria-disabled", "true");
642
646
  summary.setAttribute("tabindex", "-1");
643
647
  summary.style.setProperty("pointer-events", "none");
@@ -668,7 +672,7 @@ function isFocusable2(element) {
668
672
  * WAI-ARIA compliant disclosure pattern implementation in TypeScript.
669
673
  * Using the <details> and <summary> element.
670
674
  *
671
- * @version 1.3.2
675
+ * @version 1.3.3
672
676
  * @author Yusuke Kamiyamane
673
677
  * @license MIT
674
678
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -693,7 +697,7 @@ function isFocusable2(element) {
693
697
  * Lightweight roving tabindex utility with fully focus management.
694
698
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
695
699
  *
696
- * @version 2.0.3
700
+ * @version 2.0.4
697
701
  * @author Yusuke Kamiyamane
698
702
  * @license MIT
699
703
  * @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.3",
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"