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

fix(aria-allowed-children,aria-allowed-parent): allow group role in listbox #3195

Merged
merged 2 commits into from
Oct 8, 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
4 changes: 2 additions & 2 deletions lib/standards/aria-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ const ariaRoles = {
},
listbox: {
type: 'composite',
requiredOwned: ['option'],
requiredOwned: ['group', 'option'],
allowedAttrs: [
'aria-multiselectable',
'aria-readonly',
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/checks/aria/required-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ describe('aria-required-children', function() {

it('should fail when role does not allow group', function() {
var params = checkSetup(
'<div role="listbox" id="target"><ul role="group"><li role="option">Option</li></ul></div>'
'<div role="table" id="target"><ul role="group"><li role="row">Option</li></ul></div>'
);
assert.isFalse(
axe.testUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@
</div>

<div role="suggestion" id="fail8"></div>

<div role="listbox" id="pass9">
<div role="group">
<div role="option">option</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
["#pass5"],
["#pass6"],
["#pass7"],
["#pass8"]
["#pass8"],
["#pass9"]
],
"incomplete": [
["#incomplete1"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@
</div>
</div>
</div>

<div role="listbox">
<div role="group">
<div role="option" id="pass13">option</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
["#pass9"],
["#pass10"],
["#pass11"],
["#pass12"]
["#pass12"],
["#pass13"]
]
}