From bb7c671bfdab3385c39699b03c27cd3d94c0dd93 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Sun, 14 Feb 2021 22:28:38 +0100 Subject: [PATCH 1/8] Add initial version of aria-table-header-name rule --- doc/rule-descriptions.md | 9 +++++---- lib/rules/aria-empty-table-header.json | 12 ++++++++++++ .../aria-empty-table-header.html | 1 + .../aria-empty-table-header.json | 6 ++++++ test/rule-matches/aria-empty-table-header-matches.js | 4 ++++ 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 lib/rules/aria-empty-table-header.json create mode 100644 test/integration/rules/aria-empty-table-header/aria-empty-table-header.html create mode 100644 test/integration/rules/aria-empty-table-header/aria-empty-table-header.json create mode 100644 test/rule-matches/aria-empty-table-header-matches.js diff --git a/doc/rule-descriptions.md b/doc/rule-descriptions.md index 6440a01b39..5edf72181c 100644 --- a/doc/rule-descriptions.md +++ b/doc/rule-descriptions.md @@ -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 | +| :----------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :------ | :--------------------------- | :--------- | +| [aria-empty-table-header](https://dequeuniversity.com/rules/axe/3.5/aria-empty-table-header?application=RuleDescription) | Ensures table headers have discernible text | Minor | wcag131 | failure | +| [autocomplete-valid](https://dequeuniversity.com/rules/axe/3.5/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/3.5/avoid-inline-spacing?application=RuleDescription) | Ensure that text spacing set through style attributes can be adjusted with custom stylesheets | Serious | wcag21aa, wcag1412 | failure | ## Best Practices Rules diff --git a/lib/rules/aria-empty-table-header.json b/lib/rules/aria-empty-table-header.json new file mode 100644 index 0000000000..288fccd077 --- /dev/null +++ b/lib/rules/aria-empty-table-header.json @@ -0,0 +1,12 @@ +{ + "id": "aria-empty-table-header", + "selector": "th, [role=\"rowheader\"], [role=\"columnheader\"]", + "tags": ["wcag131"], + "metadata": { + "description": "Ensures table headers have discernible text", + "help": "Table header text must not be empty" + }, + "all": ["has-accessible-text"], + "any": [], + "none": [] +} diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html new file mode 100644 index 0000000000..b2425fa95c --- /dev/null +++ b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html @@ -0,0 +1 @@ + diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json new file mode 100644 index 0000000000..da9987f53e --- /dev/null +++ b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json @@ -0,0 +1,6 @@ +{ + "description": "aria-empty-table-header tests", + "rule": "aria-empty-table-header", + "violations": [], + "passes": [] +} diff --git a/test/rule-matches/aria-empty-table-header-matches.js b/test/rule-matches/aria-empty-table-header-matches.js new file mode 100644 index 0000000000..2faea0a523 --- /dev/null +++ b/test/rule-matches/aria-empty-table-header-matches.js @@ -0,0 +1,4 @@ +describe('aria-empty-table-header-matches', function() { + 'use strict'; + // TODO: Write tests +}); From 7fd95fd92121004f818e5a9276764540801ef428 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Wed, 17 Feb 2021 23:53:03 +0100 Subject: [PATCH 2/8] Add tests for aria-empty-table-header rule --- lib/rules/aria-empty-table-header.json | 5 +++-- .../aria-empty-table-header.html | 22 ++++++++++++++++++- .../aria-empty-table-header.json | 4 ++-- .../aria-empty-table-header-matches.js | 4 ---- 4 files changed, 26 insertions(+), 9 deletions(-) delete mode 100644 test/rule-matches/aria-empty-table-header-matches.js diff --git a/lib/rules/aria-empty-table-header.json b/lib/rules/aria-empty-table-header.json index 288fccd077..239cb90bb3 100644 --- a/lib/rules/aria-empty-table-header.json +++ b/lib/rules/aria-empty-table-header.json @@ -1,12 +1,13 @@ { "id": "aria-empty-table-header", "selector": "th, [role=\"rowheader\"], [role=\"columnheader\"]", + "matches": "heading-matches", "tags": ["wcag131"], "metadata": { "description": "Ensures table headers have discernible text", "help": "Table header text must not be empty" }, - "all": ["has-accessible-text"], - "any": [], + "all": [], + "any": ["has-accessible-text"], "none": [] } diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html index b2425fa95c..1c81cf08fc 100644 --- a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html +++ b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html @@ -1 +1,21 @@ - + + + + empty-table-header test + + + + + + Ok + rowheader with name + columnheader with name + + +
Not Ok
+ + +
Not Ok
+ + + diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json index da9987f53e..efe64c36b3 100644 --- a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json +++ b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json @@ -1,6 +1,6 @@ { "description": "aria-empty-table-header tests", "rule": "aria-empty-table-header", - "violations": [], - "passes": [] + "violations": [["fail1"], ["fail2"], ["fail3"]], + "passes": [["#pass1"], ["#pass2"], ["#pass3"]] } diff --git a/test/rule-matches/aria-empty-table-header-matches.js b/test/rule-matches/aria-empty-table-header-matches.js deleted file mode 100644 index 2faea0a523..0000000000 --- a/test/rule-matches/aria-empty-table-header-matches.js +++ /dev/null @@ -1,4 +0,0 @@ -describe('aria-empty-table-header-matches', function() { - 'use strict'; - // TODO: Write tests -}); From d40c697f8bf9b70a4e6ff6b24341bec7b0567879 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Mon, 22 Feb 2021 01:14:28 +0100 Subject: [PATCH 3/8] Fix PR comments --- doc/rule-descriptions.md | 10 +-- lib/rules/aria-empty-table-header.json | 23 +++---- .../aria-empty-table-header.html | 64 +++++++++++++------ 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/doc/rule-descriptions.md b/doc/rule-descriptions.md index 5edf72181c..11cd7098e0 100644 --- a/doc/rule-descriptions.md +++ b/doc/rule-descriptions.md @@ -69,11 +69,11 @@ ## WCAG 2.1 Level A & AA Rules -| Rule ID | Description | Impact | Tags | Issue Type | -| :----------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :------ | :--------------------------- | :--------- | -| [aria-empty-table-header](https://dequeuniversity.com/rules/axe/3.5/aria-empty-table-header?application=RuleDescription) | Ensures table headers have discernible text | Minor | wcag131 | failure | -| [autocomplete-valid](https://dequeuniversity.com/rules/axe/3.5/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/3.5/avoid-inline-spacing?application=RuleDescription) | Ensure that text spacing set through style attributes can be adjusted with custom stylesheets | Serious | wcag21aa, wcag1412 | failure | +| Rule ID | Description | Impact | Tags | Issue Type | +| :----------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :------ | :-------------------------------- | :------------------------- | +| [aria-empty-table-header](https://dequeuniversity.com/rules/axe/4.1/aria-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 diff --git a/lib/rules/aria-empty-table-header.json b/lib/rules/aria-empty-table-header.json index 239cb90bb3..dcc7c2cecb 100644 --- a/lib/rules/aria-empty-table-header.json +++ b/lib/rules/aria-empty-table-header.json @@ -1,13 +1,14 @@ { - "id": "aria-empty-table-header", - "selector": "th, [role=\"rowheader\"], [role=\"columnheader\"]", - "matches": "heading-matches", - "tags": ["wcag131"], - "metadata": { - "description": "Ensures table headers have discernible text", - "help": "Table header text must not be empty" - }, - "all": [], - "any": ["has-accessible-text"], - "none": [] + "id": "aria-empty-table-header", + "selector": "th, [role=\"rowheader\"], [role=\"columnheader\"]", + "matches": "heading-matches", + "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": [] } diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html index 1c81cf08fc..4428bee9ec 100644 --- a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html +++ b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html @@ -1,21 +1,49 @@ - - - empty-table-header test - - - + + empty-table-header test + + + - - Ok - rowheader with name - columnheader with name - - -
Not Ok
- - -
Not Ok
- - + + + + + +
Ok
+ + + + + +
rowheader with name
+ + + + + +
columnheader with name
+ + + + + +
+ + + + + +
+
Not Ok
+
+ + + + + +
+
Not Ok
+
+ From aae31391d2a6b98e1bb0332ad09b7cb3c46bdf10 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Tue, 23 Feb 2021 02:21:35 +0100 Subject: [PATCH 4/8] rename rule, fix tests --- lib/rules/aria-empty-table-header.json | 3 +-- .../aria-empty-table-header.json | 6 ----- .../empty-table-header.html} | 24 +++++++++---------- .../empty-table-header.json | 6 +++++ 4 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 test/integration/rules/aria-empty-table-header/aria-empty-table-header.json rename test/integration/rules/{aria-empty-table-header/aria-empty-table-header.html => empty-table-header/empty-table-header.html} (58%) create mode 100644 test/integration/rules/empty-table-header/empty-table-header.json diff --git a/lib/rules/aria-empty-table-header.json b/lib/rules/aria-empty-table-header.json index dcc7c2cecb..9edb3cdc18 100644 --- a/lib/rules/aria-empty-table-header.json +++ b/lib/rules/aria-empty-table-header.json @@ -1,7 +1,6 @@ { - "id": "aria-empty-table-header", + "id": "empty-table-header", "selector": "th, [role=\"rowheader\"], [role=\"columnheader\"]", - "matches": "heading-matches", "tags": ["wcag131", "cat.aria"], "reviewOnFail": true, "metadata": { diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json b/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json deleted file mode 100644 index efe64c36b3..0000000000 --- a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "description": "aria-empty-table-header tests", - "rule": "aria-empty-table-header", - "violations": [["fail1"], ["fail2"], ["fail3"]], - "passes": [["#pass1"], ["#pass2"], ["#pass3"]] -} diff --git a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html b/test/integration/rules/empty-table-header/empty-table-header.html similarity index 58% rename from test/integration/rules/aria-empty-table-header/aria-empty-table-header.html rename to test/integration/rules/empty-table-header/empty-table-header.html index 4428bee9ec..f8ab8feab9 100644 --- a/test/integration/rules/aria-empty-table-header/aria-empty-table-header.html +++ b/test/integration/rules/empty-table-header/empty-table-header.html @@ -6,41 +6,41 @@ - +
- +
OkOk
- +
- +
rowheader with namerowheader with name
- +
- +
columnheader with namecolumnheader with name
- +
- +
- +
-
+
Not Ok
- +
- diff --git a/test/integration/rules/empty-table-header/empty-table-header.json b/test/integration/rules/empty-table-header/empty-table-header.json new file mode 100644 index 0000000000..00161e67e8 --- /dev/null +++ b/test/integration/rules/empty-table-header/empty-table-header.json @@ -0,0 +1,6 @@ +{ + "description": "empty-table-header tests", + "rule": "empty-table-header", + "incomplete": [["incomplete1"], ["incomplete2"], ["incomplete3"]], + "passes": [["#pass1"], ["#pass2"], ["#pass3"]] +} From 51f75bf05430621b23649a3de0b92657fcb24bf2 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Tue, 23 Feb 2021 02:32:36 +0100 Subject: [PATCH 5/8] Rename rule From dd8c80430df05f8f44d81622c0524417e9e51419 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Tue, 23 Feb 2021 02:44:46 +0100 Subject: [PATCH 6/8] Update test file and main rule naming --- doc/rule-descriptions.md | 10 +++++----- lib/rules/empty-table-header.json | 13 +++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 lib/rules/empty-table-header.json diff --git a/doc/rule-descriptions.md b/doc/rule-descriptions.md index 11cd7098e0..6ea6128528 100644 --- a/doc/rule-descriptions.md +++ b/doc/rule-descriptions.md @@ -69,11 +69,11 @@ ## WCAG 2.1 Level A & AA Rules -| Rule ID | Description | Impact | Tags | Issue Type | -| :----------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | :------ | :-------------------------------- | :------------------------- | -| [aria-empty-table-header](https://dequeuniversity.com/rules/axe/4.1/aria-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 | +| 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 diff --git a/lib/rules/empty-table-header.json b/lib/rules/empty-table-header.json new file mode 100644 index 0000000000..9edb3cdc18 --- /dev/null +++ b/lib/rules/empty-table-header.json @@ -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": [] +} From d19ab27597b27937c0ace2d0b602e38ef1bfbb02 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Tue, 23 Feb 2021 02:48:12 +0100 Subject: [PATCH 7/8] Remove extra aria-empty-header-name rule --- lib/rules/aria-empty-table-header.json | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 lib/rules/aria-empty-table-header.json diff --git a/lib/rules/aria-empty-table-header.json b/lib/rules/aria-empty-table-header.json deleted file mode 100644 index 9edb3cdc18..0000000000 --- a/lib/rules/aria-empty-table-header.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "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": [] -} From ff43db158a2f03d06065bb97969d2601e9c76ff1 Mon Sep 17 00:00:00 2001 From: Sam Lee Date: Wed, 24 Feb 2021 00:53:50 +0100 Subject: [PATCH 8/8] Update PR for test --- .../rules/empty-table-header/empty-table-header.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/rules/empty-table-header/empty-table-header.json b/test/integration/rules/empty-table-header/empty-table-header.json index 00161e67e8..a1c725abc7 100644 --- a/test/integration/rules/empty-table-header/empty-table-header.json +++ b/test/integration/rules/empty-table-header/empty-table-header.json @@ -1,6 +1,6 @@ { "description": "empty-table-header tests", "rule": "empty-table-header", - "incomplete": [["incomplete1"], ["incomplete2"], ["incomplete3"]], + "incomplete": [["#incomplete1"], ["#incomplete2"], ["#incomplete3"]], "passes": [["#pass1"], ["#pass2"], ["#pass3"]] }
+
Not Ok