-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(empty-table-header): new rule to flag empty table headers (#2811)
* Add initial version of aria-table-header-name rule * Add tests for aria-empty-table-header rule * Fix PR comments * rename rule, fix tests * Rename rule * Update test file and main rule naming * Remove extra aria-empty-header-name rule * Update PR for test
- Loading branch information
Showing
4 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"id": "empty-table-header", | ||
"selector": "th, [role=\"rowheader\"], [role=\"columnheader\"]", | ||
"tags": ["wcag131", "cat.aria"], | ||
"reviewOnFail": true, | ||
"metadata": { | ||
"description": "Ensures table headers have discernible text", | ||
"help": "Table header text must not be empty" | ||
}, | ||
"all": [], | ||
"any": ["has-visible-text"], | ||
"none": [] | ||
} |
49 changes: 49 additions & 0 deletions
49
test/integration/rules/empty-table-header/empty-table-header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<html lang="en"> | ||
<head> | ||
<title>empty-table-header test</title> | ||
<meta charset="utf8" /> | ||
<script src="/axe.js"></script> | ||
</head> | ||
|
||
<body> | ||
<table> | ||
<tr> | ||
<th id="pass1">Ok</th> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<td id="pass2" role="rowheader">rowheader with name</td> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<td id="pass3" role="columnheader">columnheader with name</td> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<th id="incomplete1"></th> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<td id="incomplete2" role="rowheader"> | ||
<div style="display: none">Not Ok</div> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<td id="incomplete3" role="columnheader"> | ||
<div style="display: none">Not Ok</div> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
6 changes: 6 additions & 0 deletions
6
test/integration/rules/empty-table-header/empty-table-header.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"description": "empty-table-header tests", | ||
"rule": "empty-table-header", | ||
"incomplete": [["#incomplete1"], ["#incomplete2"], ["#incomplete3"]], | ||
"passes": [["#pass1"], ["#pass2"], ["#pass3"]] | ||
} |