Skip to content

Commit

Permalink
update the rule and test results #1402
Browse files Browse the repository at this point in the history
  • Loading branch information
shunguoy committed Jun 9, 2023
1 parent 8d0c50d commit 4492bfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 109 deletions.
13 changes: 6 additions & 7 deletions accessibility-checker-engine/src/v4/rules/aria_child_tabbable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,17 @@ export let aria_child_tabbable: Rule = {

let roles = ruleContext.getAttribute("role").trim().toLowerCase().split(/\s+/);
// Determine if this is referenced by a combobox. If so, focus is controlled by the combobox
// ignore if the id of the element is referenced by another element with "aria-controls" or "aria-expanded" and with certain roles. If so, focus is controlled by the referencing element
let id = ruleContext.getAttribute("id");
if (id && id.trim().length > 0) {
if (ruleContext.ownerDocument.querySelector(`*[aria-controls='${id}'][role='combobox']`)) {
/**if (ruleContext.ownerDocument.querySelector(`*[aria-controls='${id}'][role='combobox']`)) {
return null;
}

// ignore if the id of the element is referenced by another element with "aria-controls" and with certain roles. If so, focus is controlled by the referencing element
const containers = ['listbox', 'menu', 'menubar', 'radiogroup', 'tree', 'treegrid'];
if (roles && roles.length >0 && roles.some(r=>containers.includes(r)
&& ruleContext.ownerDocument.querySelector(`*[aria-controls='${id}']`))) {
*/
const elem = ruleContext.ownerDocument.querySelector(`*[aria-controls='${id}'][aria-haspopup='true'], *[aria-controls='${id}'][aria-expanded='true']`);
const containers = ['combobox', 'listbox', 'menu', 'menubar', 'radiogroup', 'tree', 'treegrid'];
if (elem && RPTUtil.isTabbable(elem) && roles && roles.length >0 && roles.some(r=>containers.includes(r)))
return null;
}
}

let passed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,108 +57,7 @@
UnitTest = {
ruleIds: ["aria_child_tabbable"],
results: [
{
"ruleId": "aria_child_tabbable",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[1]",
"aria": "/document[1]/main[1]/tablist[1]"
},
"reasonId": "pass",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_child_tabbable",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[2]",
"aria": "/document[1]/main[1]/tablist[2]"
},
"reasonId": "pass",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_child_tabbable",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[3]",
"aria": "/document[1]/main[1]/tablist[3]"
},
"reasonId": "pass",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_child_tabbable",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[4]",
"aria": "/document[1]/main[1]/tablist[4]"
},
"reasonId": "pass",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_child_tabbable",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[5]",
"aria": "/document[1]/main[1]/tablist[5]"
},
"reasonId": "fail_missing_child",
"message": "None of the descendent elements with \"tab\" role is tabbable",
"messageArgs": [
"div",
"tab"
],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_child_tabbable",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[6]",
"aria": "/document[1]/main[1]/tablist[6]"
},
"reasonId": "fail_missing_child",
"message": "None of the descendent elements with \"tab\" role is tabbable",
"messageArgs": [
"div",
"tab"
],
"apiArgs": [],
"category": "Accessibility"
}

]
};
</script>
Expand Down

0 comments on commit 4492bfd

Please sign in to comment.