From cb019755d9cb52b997aae340f406ac26d0cf90e5 Mon Sep 17 00:00:00 2001 From: Steven Lambert <2433219+straker@users.noreply.github.com> Date: Fri, 8 Oct 2021 09:33:11 -0600 Subject: [PATCH] fix(aria-allowed-children,aria-allowed-parent): allow group role in listbox (#3195) * fix(aria-allowed-children,aria-allowed-parent): allow group role in listbox * fix tests --- lib/standards/aria-roles.js | 4 ++-- test/checks/aria/required-children.js | 2 +- .../aria-required-children/aria-required-children.html | 6 ++++++ .../aria-required-children/aria-required-children.json | 3 ++- .../rules/aria-required-parent/aria-required-parent.html | 6 ++++++ .../rules/aria-required-parent/aria-required-parent.json | 3 ++- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/standards/aria-roles.js b/lib/standards/aria-roles.js index a21fe4a2b1..f1291d37f0 100644 --- a/lib/standards/aria-roles.js +++ b/lib/standards/aria-roles.js @@ -284,7 +284,7 @@ const ariaRoles = { }, listbox: { type: 'composite', - requiredOwned: ['option'], + requiredOwned: ['group', 'option'], allowedAttrs: [ 'aria-multiselectable', 'aria-readonly', @@ -418,7 +418,7 @@ const ariaRoles = { }, option: { type: 'widget', - requiredContext: ['listbox'], + requiredContext: ['group', 'listbox'], // Note: since the option role has an implicit // aria-selected value it is not required to be added by // the user diff --git a/test/checks/aria/required-children.js b/test/checks/aria/required-children.js index 38e1ccaae9..c5fba9de19 100644 --- a/test/checks/aria/required-children.js +++ b/test/checks/aria/required-children.js @@ -323,7 +323,7 @@ describe('aria-required-children', function() { it('should fail when role does not allow group', function() { var params = checkSetup( - '
' + '
' ); assert.isFalse( axe.testUtils diff --git a/test/integration/rules/aria-required-children/aria-required-children.html b/test/integration/rules/aria-required-children/aria-required-children.html index 89024d8623..0241ec6643 100644 --- a/test/integration/rules/aria-required-children/aria-required-children.html +++ b/test/integration/rules/aria-required-children/aria-required-children.html @@ -62,3 +62,9 @@
+ +
+
+
option
+
+
diff --git a/test/integration/rules/aria-required-children/aria-required-children.json b/test/integration/rules/aria-required-children/aria-required-children.json index 05bcfa7185..3e75156fb2 100644 --- a/test/integration/rules/aria-required-children/aria-required-children.json +++ b/test/integration/rules/aria-required-children/aria-required-children.json @@ -19,7 +19,8 @@ ["#pass5"], ["#pass6"], ["#pass7"], - ["#pass8"] + ["#pass8"], + ["#pass9"] ], "incomplete": [ ["#incomplete1"], diff --git a/test/integration/rules/aria-required-parent/aria-required-parent.html b/test/integration/rules/aria-required-parent/aria-required-parent.html index 3c0d5588d1..be9ef5a4d9 100644 --- a/test/integration/rules/aria-required-parent/aria-required-parent.html +++ b/test/integration/rules/aria-required-parent/aria-required-parent.html @@ -58,3 +58,9 @@ + +
+
+
option
+
+
diff --git a/test/integration/rules/aria-required-parent/aria-required-parent.json b/test/integration/rules/aria-required-parent/aria-required-parent.json index df291caf49..0092d17059 100644 --- a/test/integration/rules/aria-required-parent/aria-required-parent.json +++ b/test/integration/rules/aria-required-parent/aria-required-parent.json @@ -22,6 +22,7 @@ ["#pass9"], ["#pass10"], ["#pass11"], - ["#pass12"] + ["#pass12"], + ["#pass13"] ] }