Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(empty-table-header): new rule to flag empty table headers #2811

Merged
merged 8 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@

## WCAG 2.1 Level A & AA Rules

| Rule ID | Description | Impact | Tags | Issue Type |
| :----------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :------ | :-------------------------------- | :--------- |
| [autocomplete-valid](https://dequeuniversity.com/rules/axe/4.1/autocomplete-valid?application=RuleDescription) | Ensure the autocomplete attribute is correct and suitable for the form field | Serious | cat.forms, wcag21aa, wcag135 | failure |
| [avoid-inline-spacing](https://dequeuniversity.com/rules/axe/4.1/avoid-inline-spacing?application=RuleDescription) | Ensure that text spacing set through style attributes can be adjusted with custom stylesheets | Serious | cat.structure, wcag21aa, wcag1412 | failure |
| Rule ID | Description | Impact | Tags | Issue Type |
| :----------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :------ | :-------------------------------- | :------------------------- |
| [empty-table-header](https://dequeuniversity.com/rules/axe/4.1/empty-table-header?application=RuleDescription) | Ensures table headers have discernible text | Minor | wcag131, cat.aria | failure, needs review |
| [autocomplete-valid](https://dequeuniversity.com/rules/axe/4.1/autocomplete-valid?application=RuleDescription) | Ensure the autocomplete attribute is correct and suitable for the form field | Serious | cat.forms, wcag21aa, wcag135 | failure |
| [avoid-inline-spacing](https://dequeuniversity.com/rules/axe/4.1/avoid-inline-spacing?application=RuleDescription) | Ensure that text spacing set through style attributes can be adjusted with custom stylesheets | Serious | cat.structure, wcag21aa, wcag1412 | failure |

## Best Practices Rules

Expand Down
13 changes: 13 additions & 0 deletions lib/rules/empty-table-header.json
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": []
}
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>
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"]]
}