@cocreate/aria 1.0.0 → 1.1.1

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.
@@ -22,13 +22,13 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  steps:
24
24
  - name: Checkout
25
- uses: actions/checkout@v3
25
+ uses: actions/checkout@v4
26
26
  - name: Setup Node.js
27
- uses: actions/setup-node@v3
27
+ uses: actions/setup-node@v4
28
28
  with:
29
- node-version: 14
29
+ node-version: 22 # Required for the latest semantic-release plugins
30
30
  - name: Semantic Release
31
- uses: cycjimmy/semantic-release-action@v3
31
+ uses: cycjimmy/semantic-release-action@v4 # Update to v4 for better Node 20+ support
32
32
  id: semantic
33
33
  with:
34
34
  extra_plugins: |
@@ -36,9 +36,8 @@ jobs:
36
36
  @semantic-release/git
37
37
  @semantic-release/github
38
38
  env:
39
- GITHUB_TOKEN: "${{ secrets.GITHUB }}"
39
+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # Use the built-in token if possible
40
40
  NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
41
41
  outputs:
42
42
  new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
43
  new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
-
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.1.1](https://github.com/CoCreate-app/CoCreate-aria/compare/v1.1.0...v1.1.1) (2025-12-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update worklow ([32b1cff](https://github.com/CoCreate-app/CoCreate-aria/commit/32b1cffdce4f66ab078407cae412a5583afb92a4))
7
+
8
+ # [1.1.0](https://github.com/CoCreate-app/CoCreate-aria/compare/v1.0.0...v1.1.0) (2025-11-16)
9
+
10
+
11
+ ### Features
12
+
13
+ * Enhance popup close conditions and aria attributes handling ([608da59](https://github.com/CoCreate-app/CoCreate-aria/commit/608da59ac5f179a2c9ddf27d2657c2f28d355766))
14
+ * Initialize aria controls and enhance event handling ([a62f790](https://github.com/CoCreate-app/CoCreate-aria/commit/a62f79079a0c889b8d395406df2ef4a704ac6552))
15
+
1
16
  # 1.0.0 (2025-08-25)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/aria",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Chain multiple component executions to generate your desired logic, when one action is complete next one will start. The sequence goes until all aria have been completed. Vanilla javascript, easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "aria",
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ let popupListener = null;
11
11
  function addPopupListener() {
12
12
  if (!popupListener) {
13
13
  popupListener = function (event) {
14
+
14
15
  const hasPopUps = document.querySelectorAll(
15
16
  '[aria-controls][aria-haspopup][aria-expanded="true"]'
16
17
  );
@@ -25,6 +26,7 @@ function addPopupListener() {
25
26
  skipControlledId = controlledId;
26
27
  continue; // Ignore clicks inside the popup
27
28
  }
29
+
28
30
  const controlledElement = document.getElementById(controlledId);
29
31
  let closeOn = controlledElement.getAttribute("aria-close-on");
30
32
  let closeOnEl = controlledElement;
@@ -37,13 +39,26 @@ function addPopupListener() {
37
39
  }
38
40
  }
39
41
 
40
- if (closeOn === "outside") {
41
- if (closeOnEl.contains(event.target)) continue;
42
- } else if (closeOn === "button" || closeOn === "btn") {
43
- continue;
42
+ let closeOnConditions = closeOn ? closeOn.split(",").map(c => c.trim()) : [];
43
+
44
+ let shouldClose = false;
45
+ for (let condition of closeOnConditions) {
46
+ if (condition === "outside" && !closeOnEl.contains(event.target)) {
47
+ shouldClose = true;
48
+ } else if (condition === "inside" && closeOnEl.contains(event.target)) {
49
+ shouldClose = true;
50
+ } else if (condition === "anywhere") {
51
+ shouldClose = true;
52
+ }
53
+
54
+ // If any condition matches, break the loop
55
+ if (shouldClose) break;
44
56
  }
45
57
 
58
+ if (!shouldClose) continue;
59
+
46
60
  controlledElement.classList.remove("show");
61
+ controlledElement.setAttribute("aria-hidden", "true");
47
62
  updateAllControls(controlledId, "false");
48
63
  }
49
64
  // Remove listener if no popups remain open
@@ -104,6 +119,7 @@ function initElement(elements) {
104
119
  const hasAriaOpen = this.hasAttribute("aria-open");
105
120
  const hasAriaClose = this.hasAttribute("aria-close");
106
121
  const expanded = this.getAttribute("aria-expanded");
122
+ const controlsClass = this.getAttribute("aria-controls-class") || "show";
107
123
 
108
124
  // Apply aria-open and aria-close logic globally, before any role-specific logic
109
125
  if (hasAriaOpen && expanded === "true") {
@@ -124,20 +140,32 @@ function initElement(elements) {
124
140
  document.getElementById(tabControlledId);
125
141
  if (this === tab) {
126
142
  tab.setAttribute("aria-selected", "true");
127
- tabControlledEl.classList.add("show");
143
+ tabControlledEl.setAttribute("aria-hidden", "false");
144
+ if (controlsClass) {
145
+ tabControlledEl.classList.add(controlsClass);
146
+ }
128
147
  } else {
129
148
  tab.setAttribute("aria-selected", "false");
130
- tabControlledEl.classList.remove("show");
149
+ tabControlledEl.setAttribute("aria-hidden", "true");
150
+ if (controlsClass) {
151
+ tabControlledEl.classList.remove(controlsClass);
152
+ }
131
153
  }
132
154
  }
133
155
  } else {
134
156
  // Default toggle logic
135
157
  if (expanded === "true") {
136
- controlledElement.classList.remove("show");
158
+ controlledElement.setAttribute("aria-hidden", "true");
159
+ if (controlsClass) {
160
+ controlledElement.classList.remove(controlsClass);
161
+ }
137
162
  updateAllControls(controlledId, "false");
138
163
  removePopupListener();
139
164
  } else {
140
- controlledElement.classList.add("show");
165
+ controlledElement.setAttribute("aria-hidden", "false");
166
+ if (controlsClass) {
167
+ controlledElement.classList.add(controlsClass);
168
+ }
141
169
  updateAllControls(controlledId, "true");
142
170
  if (closeOn !== "btn" && closeOn !== "button") {
143
171
  addPopupListener();