From 114501f09ce7d7377f2757e41c0af24d06f6420e Mon Sep 17 00:00:00 2001 From: Matt Isner Date: Mon, 2 Oct 2017 16:12:34 -0400 Subject: [PATCH] fix(aria-allowed-attr): align rowcount, colcount, and colindex with 1.1 spec Allow aria-rowcount and aria-colcount on role=grid; disallow the same on role=row; allow aria-colindex on role=row https://github.com/dequelabs/axe-core/issues/547 --- lib/commons/aria/index.js | 14 ++++++++------ .../rules/aria-allowed-attr/failures.html | 2 ++ .../rules/aria-allowed-attr/failures.json | 4 ++-- .../rules/aria-allowed-attr/passes.html | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/commons/aria/index.js b/lib/commons/aria/index.js index d6fbb9983b..c93c95cd51 100644 --- a/lib/commons/aria/index.js +++ b/lib/commons/aria/index.js @@ -250,7 +250,7 @@ lookupTables.role = { 'columnheader': { type: 'structure', attributes: { - allowed: ['aria-colindex', 'aria-colspan', 'aria-expanded', 'aria-rowindex', 'aria-rowspan', + allowed: ['aria-colindex', 'aria-colspan', 'aria-expanded', 'aria-rowindex', 'aria-rowspan', 'aria-required', 'aria-readonly', 'aria-selected', 'aria-sort'] }, owned: null, @@ -341,7 +341,7 @@ lookupTables.role = { attributes: { allowed: ['aria-expanded'] }, - owned: { + owned: { one: ['article'] }, nameFrom: ['author'], @@ -360,7 +360,8 @@ lookupTables.role = { 'grid': { type: 'composite', attributes: { - allowed: ['aria-level', 'aria-multiselectable', 'aria-readonly', 'aria-activedescendant', 'aria-expanded'] + allowed: ['aria-activedescendant', 'aria-expanded', 'aria-colcount', 'aria-level', + 'aria-multiselectable', 'aria-readonly', 'aria-rowcount'] }, owned: { one: ['rowgroup', 'row'] @@ -372,7 +373,7 @@ lookupTables.role = { 'gridcell': { type: 'widget', attributes: { - allowed: ['aria-colindex', 'aria-colspan', 'aria-expanded', 'aria-rowindex', + allowed: ['aria-colindex', 'aria-colspan', 'aria-expanded', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-readonly', 'aria-required'] }, owned: null, @@ -645,7 +646,8 @@ lookupTables.role = { 'row': { type: 'structure', attributes: { - allowed: ['aria-activedescendant', 'aria-colcount', 'aria-expanded', 'aria-level', 'aria-selected', 'aria-rowcount', 'aria-rowindex'] + allowed: ['aria-activedescendant', 'aria-colindex', 'aria-expanded', + 'aria-level', 'aria-selected', 'aria-rowindex'] }, owned: { one: ['cell', 'columnheader', 'rowheader', 'gridcell'] @@ -669,7 +671,7 @@ lookupTables.role = { 'rowheader': { type: 'structure', attributes: { - allowed: ['aria-colindex', 'aria-colspan', 'aria-expanded', 'aria-rowindex', 'aria-rowspan', + allowed: ['aria-colindex', 'aria-colspan', 'aria-expanded', 'aria-rowindex', 'aria-rowspan', 'aria-required', 'aria-readonly', 'aria-selected', 'aria-sort'] }, owned: null, diff --git a/test/integration/rules/aria-allowed-attr/failures.html b/test/integration/rules/aria-allowed-attr/failures.html index 6fcc27e848..d6760c0c4a 100644 --- a/test/integration/rules/aria-allowed-attr/failures.html +++ b/test/integration/rules/aria-allowed-attr/failures.html @@ -1,3 +1,5 @@
fail
+
fail
+
fail
diff --git a/test/integration/rules/aria-allowed-attr/failures.json b/test/integration/rules/aria-allowed-attr/failures.json index 311e1ea5ab..06831d9b49 100644 --- a/test/integration/rules/aria-allowed-attr/failures.json +++ b/test/integration/rules/aria-allowed-attr/failures.json @@ -2,6 +2,6 @@ "description": "aria-allowed-attr failing tests", "rule": "aria-allowed-attr", "violations": [ - ["#fail1"], ["#fail2"] + ["#fail1"], ["#fail2"], ["#fail3"], ["#fail4"] ] -} \ No newline at end of file +} diff --git a/test/integration/rules/aria-allowed-attr/passes.html b/test/integration/rules/aria-allowed-attr/passes.html index 079840546c..90f5387c48 100644 --- a/test/integration/rules/aria-allowed-attr/passes.html +++ b/test/integration/rules/aria-allowed-attr/passes.html @@ -35,7 +35,7 @@
ok
-
ok
+
ok
ok
@@ -85,7 +85,7 @@
ok
-
ok
+
ok
ok