aria-ease 5.0.1 → 5.0.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
@@ -175,7 +175,7 @@ useEffect(() => {
175
175
  accordionId: "accordion-container",
176
176
  triggersClass: "accordion-trigger",
177
177
  panelsClass: "accordion-panel",
178
- allowMultiple: false, // Only one panel open at a time (default)
178
+ allowMultipleOpen: false, // Only one panel open at a time (default)
179
179
  });
180
180
 
181
181
  return () => accordion.cleanup();
@@ -214,7 +214,7 @@ makeAccordionAccessible({
214
214
  accordionId: "faq-div",
215
215
  triggersClass: "dropdown-button",
216
216
  panelsClass: "accordion-panel",
217
- allowMultiple: false, // Only one panel open at a time
217
+ allowMultipleOpen: false, // Only one panel open at a time
218
218
  });
219
219
  ```
220
220
 
@@ -1,4 +1,4 @@
1
- import "./chunk-2P3A4VVY.js";
1
+ import "./chunk-I2KLQ2HA.js";
2
2
 
3
3
  // src/utils/audit/src/audit/audit.ts
4
4
  import AxeBuilder from "@axe-core/playwright";
@@ -1,12 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
5
  var __export = (target, all) => {
11
6
  for (var name in all)
12
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,18 +15,8 @@ var __copyProps = (to, from, except, desc) => {
20
15
  return to;
21
16
  };
22
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
18
 
32
19
  export {
33
- __commonJS,
34
20
  __export,
35
- __reExport,
36
- __toESM
21
+ __reExport
37
22
  };
@@ -7,6 +7,10 @@ var contract_default = {
7
7
  combobox: {
8
8
  path: "./contracts/ComboboxContract.json",
9
9
  component: "combobox"
10
+ },
11
+ accordion: {
12
+ path: "./contracts/AccordionContract.json",
13
+ component: "accordion"
10
14
  }
11
15
  };
12
16
 
@@ -19,17 +23,22 @@ var ContractReporter = class {
19
23
  dynamicResults = [];
20
24
  totalTests = 0;
21
25
  skipped = 0;
26
+ optionalSuggestions = 0;
22
27
  isPlaywright = false;
28
+ apgUrl = "https://www.w3.org/WAI/ARIA/apg/";
23
29
  constructor(isPlaywright = false) {
24
30
  this.isPlaywright = isPlaywright;
25
31
  }
26
32
  log(message) {
27
33
  process.stderr.write(message + "\n");
28
34
  }
29
- start(componentName, totalTests) {
35
+ start(componentName, totalTests, apgUrl) {
30
36
  this.startTime = Date.now();
31
37
  this.componentName = componentName;
32
38
  this.totalTests = totalTests;
39
+ if (apgUrl) {
40
+ this.apgUrl = apgUrl;
41
+ }
33
42
  const mode = this.isPlaywright ? "Playwright (Real Browser)" : "jsdom (Fast)";
34
43
  this.log(`
35
44
  ${"\u2550".repeat(60)}`);
@@ -42,10 +51,21 @@ ${"\u2550".repeat(60)}`);
42
51
  this.staticFailures = failures;
43
52
  const icon = failures === 0 ? "\u2705" : "\u274C";
44
53
  const status = failures === 0 ? "PASS" : "FAIL";
54
+ this.log("");
45
55
  this.log(`${icon} Static ARIA Tests: ${status}`);
46
56
  this.log(` ${passes}/${passes + failures} required attributes present
47
57
  `);
48
58
  }
59
+ /**
60
+ * Report individual static test pass
61
+ */
62
+ reportStaticTest(description, passed, failureMessage) {
63
+ const icon = passed ? "\u2713" : "\u2717";
64
+ this.log(` ${icon} ${description}`);
65
+ if (!passed && failureMessage) {
66
+ this.log(` \u21B3 ${failureMessage}`);
67
+ }
68
+ }
49
69
  /**
50
70
  * Report individual dynamic test result
51
71
  */
@@ -53,20 +73,25 @@ ${"\u2550".repeat(60)}`);
53
73
  const result = {
54
74
  description: test.description,
55
75
  status,
56
- failureMessage
76
+ failureMessage,
77
+ isOptional: test.isOptional
57
78
  };
58
79
  if (status === "skip" && test.requiresBrowser) {
59
80
  result.skipReason = "Requires real browser (addEventListener events)";
60
81
  }
61
82
  this.dynamicResults.push(result);
62
- const icons = { pass: "\u2713", fail: "\u2717", skip: "\u25CB" };
63
- this.log(` ${icons[status]} ${test.description}`);
83
+ const icons = { pass: "\u2713", fail: "\u2717", skip: "\u25CB", "optional-fail": "\u25CB" };
84
+ const prefix = test.isOptional ? "[OPTIONAL] " : "";
85
+ this.log(` ${icons[status]} ${prefix}${test.description}`);
64
86
  if (status === "skip" && !this.isPlaywright) {
65
87
  this.log(` \u21B3 Skipped in jsdom (runs in Playwright)`);
66
88
  }
67
- if (status === "fail" && failureMessage) {
89
+ if (status === "fail" && failureMessage && !test.isOptional) {
68
90
  this.log(` \u21B3 ${failureMessage}`);
69
91
  }
92
+ if (status === "optional-fail") {
93
+ this.log(` \u21B3 Not implemented (recommended for enhanced UX)`);
94
+ }
70
95
  }
71
96
  /**
72
97
  * Report all failures with actionable context
@@ -89,6 +114,30 @@ ${"\u2500".repeat(60)}`);
89
114
  this.log("");
90
115
  });
91
116
  }
117
+ /**
118
+ * Report optional features that aren't implemented
119
+ */
120
+ reportOptionalSuggestions() {
121
+ const suggestions = this.dynamicResults.filter((r) => r.status === "optional-fail");
122
+ if (suggestions.length === 0) return;
123
+ this.log(`
124
+ ${"\u2500".repeat(60)}`);
125
+ this.log(`\u{1F4A1} Optional Enhancements (${suggestions.length}):
126
+ `);
127
+ this.log(`These features are optional per APG guidelines but recommended`);
128
+ this.log(`for improved user experience and keyboard navigation:
129
+ `);
130
+ suggestions.forEach((test, index) => {
131
+ this.log(`${index + 1}. ${test.description}`);
132
+ if (test.failureMessage) {
133
+ this.log(` \u21B3 ${test.failureMessage}`);
134
+ }
135
+ });
136
+ this.log(`
137
+ \u2728 Consider implementing these for better accessibility`);
138
+ this.log(` Reference: ${this.apgUrl}
139
+ `);
140
+ }
92
141
  /**
93
142
  * Report skipped tests with helpful context
94
143
  */
@@ -118,30 +167,40 @@ ${"\u2500".repeat(60)}`);
118
167
  const dynamicPasses = this.dynamicResults.filter((r) => r.status === "pass").length;
119
168
  const dynamicFailures = this.dynamicResults.filter((r) => r.status === "fail").length;
120
169
  this.skipped = this.dynamicResults.filter((r) => r.status === "skip").length;
170
+ this.optionalSuggestions = this.dynamicResults.filter((r) => r.status === "optional-fail").length;
121
171
  const totalPasses = this.staticPasses + dynamicPasses;
122
172
  const totalFailures = this.staticFailures + dynamicFailures;
123
173
  const totalRun = totalPasses + totalFailures;
124
174
  if (failures.length > 0) {
125
175
  this.reportFailures(failures);
126
176
  }
177
+ this.reportOptionalSuggestions();
127
178
  this.reportSkipped();
128
179
  this.log(`
129
180
  ${"\u2550".repeat(60)}`);
130
181
  this.log(`\u{1F4CA} Summary
131
182
  `);
132
- if (totalFailures === 0 && this.skipped === 0) {
183
+ if (totalFailures === 0 && this.skipped === 0 && this.optionalSuggestions === 0) {
133
184
  this.log(`\u2705 All ${totalRun} tests passed!`);
134
185
  this.log(` ${this.componentName} component meets APG and WCAG guidelines \u2713`);
135
186
  } else if (totalFailures === 0) {
136
- this.log(`\u2705 ${totalPasses}/${totalRun} tests passed`);
137
- this.log(`\u25CB ${this.skipped} tests skipped (jsdom limitation)`);
138
- this.log(` ${this.componentName} component works correctly`);
187
+ this.log(`\u2705 ${totalPasses}/${totalRun} required tests passed`);
188
+ if (this.skipped > 0) {
189
+ this.log(`\u25CB ${this.skipped} tests skipped (jsdom limitation)`);
190
+ }
191
+ if (this.optionalSuggestions > 0) {
192
+ this.log(`\u{1F4A1} ${this.optionalSuggestions} optional enhancement${this.optionalSuggestions > 1 ? "s" : ""} suggested`);
193
+ }
194
+ this.log(` ${this.componentName} component meets required standards \u2713`);
139
195
  } else {
140
196
  this.log(`\u274C ${totalFailures} test${totalFailures > 1 ? "s" : ""} failed`);
141
197
  this.log(`\u2705 ${totalPasses} test${totalPasses > 1 ? "s" : ""} passed`);
142
198
  if (this.skipped > 0) {
143
199
  this.log(`\u25CB ${this.skipped} test${this.skipped > 1 ? "s" : ""} skipped`);
144
200
  }
201
+ if (this.optionalSuggestions > 0) {
202
+ this.log(`\u{1F4A1} ${this.optionalSuggestions} optional enhancement${this.optionalSuggestions > 1 ? "s" : ""} suggested`);
203
+ }
145
204
  }
146
205
  this.log(`\u23F1\uFE0F Duration: ${duration}ms`);
147
206
  this.log(`${"\u2550".repeat(60)}