test-a11y-js 0.8.0 → 0.8.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.
- package/README.md +69 -0
- package/dist/index.js +4 -1
- package/dist/index.mjs +4 -1
- package/dist/linter/eslint-plugin/index.js +4 -1
- package/dist/linter/eslint-plugin/index.mjs +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,7 +166,18 @@ const videoViolations = A11yChecker.checkVideoCaptions(element)
|
|
|
166
166
|
const audioViolations = A11yChecker.checkAudioCaptions(element)
|
|
167
167
|
const landmarkViolations = A11yChecker.checkLandmarks(element)
|
|
168
168
|
const dialogViolations = A11yChecker.checkDialogModal(element)
|
|
169
|
+
|
|
170
|
+
// Phase 1: ARIA, Semantic HTML, Form Validation
|
|
171
|
+
const ariaRoleViolations = A11yChecker.checkAriaRoles(element)
|
|
172
|
+
const ariaPropertyViolations = A11yChecker.checkAriaProperties(element)
|
|
173
|
+
const ariaRelationshipViolations = A11yChecker.checkAriaRelationships(element)
|
|
174
|
+
const accessibleNameViolations = A11yChecker.checkAccessibleName(element)
|
|
175
|
+
const compositePatternViolations = A11yChecker.checkCompositePatterns(element)
|
|
176
|
+
const semanticHTMLViolations = A11yChecker.checkSemanticHTML(element)
|
|
177
|
+
const formValidationViolations = A11yChecker.checkFormValidationMessages(element)
|
|
169
178
|
```
|
|
179
|
+
<|tool▁calls▁begin|><|tool▁call▁begin|>
|
|
180
|
+
read_file
|
|
170
181
|
|
|
171
182
|
## API
|
|
172
183
|
|
|
@@ -362,6 +373,64 @@ function MyComponent() {
|
|
|
362
373
|
</template>
|
|
363
374
|
```
|
|
364
375
|
|
|
376
|
+
### ARIA Validation (Phase 1)
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
// ❌ ESLint will catch these ARIA issues
|
|
380
|
+
function MyComponent() {
|
|
381
|
+
return (
|
|
382
|
+
<div>
|
|
383
|
+
<div role="invalid-role">Content</div> {/* Invalid role */}
|
|
384
|
+
<button role="button">Click</button> {/* Redundant role */}
|
|
385
|
+
<div role="tab">Tab</div> {/* Missing tablist context */}
|
|
386
|
+
<input aria-label="" /> {/* Empty aria-label */}
|
|
387
|
+
</div>
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// ✅ Fixed
|
|
392
|
+
function MyComponent() {
|
|
393
|
+
return (
|
|
394
|
+
<div role="tablist">
|
|
395
|
+
<button>Click</button> {/* Native button, no role needed */}
|
|
396
|
+
<div role="tab" aria-controls="panel-1">Tab</div>
|
|
397
|
+
<input aria-label="Email address" />
|
|
398
|
+
</div>
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Semantic HTML (Phase 1)
|
|
404
|
+
|
|
405
|
+
```tsx
|
|
406
|
+
// ❌ ESLint will catch semantic HTML misuse
|
|
407
|
+
function MyComponent() {
|
|
408
|
+
return (
|
|
409
|
+
<div>
|
|
410
|
+
<div role="button" onClick={handleClick}>Click</div> {/* Use <button> */}
|
|
411
|
+
<a>Link without href</a> {/* Missing href */}
|
|
412
|
+
<button><a href="/">Nested link</a></button> {/* Nested interactive */}
|
|
413
|
+
<main>Content</main>
|
|
414
|
+
<main>Another main</main> {/* Multiple main */}
|
|
415
|
+
</div>
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// ✅ Fixed
|
|
420
|
+
function MyComponent() {
|
|
421
|
+
return (
|
|
422
|
+
<div>
|
|
423
|
+
<button onClick={handleClick}>Click</button>
|
|
424
|
+
<a href="/page">Link</a>
|
|
425
|
+
<button>Action</button>
|
|
426
|
+
<main>Content</main>
|
|
427
|
+
</div>
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
<|tool▁calls▁begin|><|tool▁call▁begin|>
|
|
432
|
+
run_terminal_cmd
|
|
433
|
+
|
|
365
434
|
## How It Compares
|
|
366
435
|
|
|
367
436
|
| Feature | test-a11y-js | eslint-plugin-jsx-a11y | @axe-core/react |
|
package/dist/index.js
CHANGED
|
@@ -1832,7 +1832,10 @@ ${index + 1}. ${violation.id} (${violation.impact})`);
|
|
|
1832
1832
|
if (!ids.has(id)) {
|
|
1833
1833
|
ids.set(id, []);
|
|
1834
1834
|
}
|
|
1835
|
-
ids.get(id)
|
|
1835
|
+
const elements = ids.get(id);
|
|
1836
|
+
if (elements) {
|
|
1837
|
+
elements.push(el);
|
|
1838
|
+
}
|
|
1836
1839
|
}
|
|
1837
1840
|
}
|
|
1838
1841
|
for (const [id, elements] of ids.entries()) {
|
package/dist/index.mjs
CHANGED
|
@@ -1813,7 +1813,10 @@ ${index + 1}. ${violation.id} (${violation.impact})`);
|
|
|
1813
1813
|
if (!ids.has(id)) {
|
|
1814
1814
|
ids.set(id, []);
|
|
1815
1815
|
}
|
|
1816
|
-
ids.get(id)
|
|
1816
|
+
const elements = ids.get(id);
|
|
1817
|
+
if (elements) {
|
|
1818
|
+
elements.push(el);
|
|
1819
|
+
}
|
|
1817
1820
|
}
|
|
1818
1821
|
}
|
|
1819
1822
|
for (const [id, elements] of ids.entries()) {
|
|
@@ -1900,7 +1900,10 @@ ${index + 1}. ${violation.id} (${violation.impact})`);
|
|
|
1900
1900
|
if (!ids.has(id)) {
|
|
1901
1901
|
ids.set(id, []);
|
|
1902
1902
|
}
|
|
1903
|
-
ids.get(id)
|
|
1903
|
+
const elements = ids.get(id);
|
|
1904
|
+
if (elements) {
|
|
1905
|
+
elements.push(el);
|
|
1906
|
+
}
|
|
1904
1907
|
}
|
|
1905
1908
|
}
|
|
1906
1909
|
for (const [id, elements] of ids.entries()) {
|
|
@@ -1882,7 +1882,10 @@ ${index + 1}. ${violation.id} (${violation.impact})`);
|
|
|
1882
1882
|
if (!ids.has(id)) {
|
|
1883
1883
|
ids.set(id, []);
|
|
1884
1884
|
}
|
|
1885
|
-
ids.get(id)
|
|
1885
|
+
const elements = ids.get(id);
|
|
1886
|
+
if (elements) {
|
|
1887
|
+
elements.push(el);
|
|
1888
|
+
}
|
|
1886
1889
|
}
|
|
1887
1890
|
}
|
|
1888
1891
|
for (const [id, elements] of ids.entries()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-a11y-js",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Zero-config accessibility testing for React, Vue & JSX. ESLint plugin + programmatic API. Catch a11y issues before production.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|