Skip to content

Commit

Permalink
Merge branch 'master' into ali-deprecating_Rpt_Aria_MultipleGroupRole…
Browse files Browse the repository at this point in the history
…s_Implicit
  • Loading branch information
ErickRenteria authored Feb 3, 2022
2 parents 5a8877a + 3bb5e0d commit dac522d
Show file tree
Hide file tree
Showing 14 changed files with 631 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ let a11yRulesInput: Rule[] = [
(!labelElem && RPTUtil.attributeNonEmpty(ruleContext, "title") || RPTUtil.attributeNonEmpty(ruleContext, "placeholder")) ||
RPTUtil.getAriaLabel(ruleContext).trim().length > 0 || RPTUtil.hasImplicitLabel(ruleContext);
if (!passed) POF = 2 + textTypes.indexOf(type);

} else if (buttonTypes.indexOf(type) !== -1) { // If type is a button
if (buttonTypesWithDefaults.indexOf(type) !== -1 && !ruleContext.hasAttribute("value")) {
// 'submit' and 'reset' have visible defaults so pass if there is no 'value' attribute
Expand Down Expand Up @@ -143,6 +144,23 @@ let a11yRulesInput: Rule[] = [
passed = RPTUtil.attributeNonEmpty(ruleContext, "label") || ruleContext.innerHTML.trim().length > 0;
if (!passed) POF = 2 + textTypes.length + buttonTypes.length + 3;
}
if (!passed) {
// check aria role
//TODO: consider other aria roles relevant, other than menuitemcheckbox
const singleRole = RPTUtil.hasRoleInSemantics(ruleContext, "menuitemcheckbox") || RPTUtil.hasRoleInSemantics(ruleContext, "menuitemradio")
|| RPTUtil.hasRole(ruleContext, "radio", false);
const otherRole = RPTUtil.hasRole(ruleContext, "listbox", false) || RPTUtil.hasRole(ruleContext, "textbox", false)
|| RPTUtil.hasRole(ruleContext, "searchbox", false);

if (singleRole)
passed = RPTUtil.getInnerText(ruleContext) && RPTUtil.getInnerText(ruleContext).trim().length > 0;
else if (otherRole) {
passed = RPTUtil.attributeNonEmpty(ruleContext, "aria-label") || RPTUtil.attributeNonEmpty(ruleContext, "aria-labelledby")
|| RPTUtil.attributeNonEmpty(ruleContext, "title");
} else {
// any other role?
}
}

if (passed) {
return RulePass("Pass_0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,51 +88,49 @@ <h3>WAI-ARIA widgets that must be explicitly labelled by an aria-label, aria-lab
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
OpenAjax.a11y.ruleCoverage = [{
ruleId: "1156",
OpenAjax.a11y.ruleCoverage = [
{
ruleId: "41",
passedXpaths: [],
failedXpaths: [
"/html/body/div[1]",
"/html/body/div[3]",
"/html/body/div[4]",
// "/html/body/div[6]", // log does not have a required name in ARIA 1.2
"/html/body/div[7]",
"/html/body/div[10]",
"/html/body/div[13]",
// "/html/body/div[15]", // timer does not have a required name in ARIA 1.2
"/html/body/div[16]",
"/html/body/div[17]",
"/html/body/div[18]",
"/html/body/div[19]",
"/html/body/div[20]",
// "/html/body/div[22]", // log does not have a required name in ARIA 1.2
"/html/body/div[23]",
"/html/body/div[26]",
"/html/body/div[29]",
// "/html/body/div[31]", // timer does not have a required name in ARIA 1.2
"/html/body/div[32]",
"/html/body/div[33]",
"/html/body/div[34]",
"/html/body/div[35]"
"/html[1]/body[1]/div[11]",
"/html[1]/body[1]/div[12]",
"/html[1]/body[1]/div[14]",
"/html[1]/body[1]/div[21]",
"/html[1]/body[1]/div[25]",
"/html[1]/body[1]/div[27]",
"/html[1]/body[1]/div[28]",
"/html[1]/body[1]/div[2]",
"/html[1]/body[1]/div[30]",
"/html[1]/body[1]/div[5]",
"/html[1]/body[1]/div[9]"
]
},
{
ruleId: "41",
ruleId: "1156",
passedXpaths: [],
failedXpaths: [
"/html/body/div[2]",
"/html/body/div[5]",
"/html/body/div[9]",
"/html/body/div[11]",
"/html/body/div[12]",
"/html/body/div[14]",
"/html/body/div[21]",
"/html/body/div[25]",
"/html/body/div[27]",
"/html/body/div[28]",
"/html/body/div[30]",
"/html[1]/body[1]/div[10]",
"/html[1]/body[1]/div[13]",
"/html[1]/body[1]/div[16]",
"/html[1]/body[1]/div[17]",
"/html[1]/body[1]/div[18]",
"/html[1]/body[1]/div[19]",
"/html[1]/body[1]/div[1]",
"/html[1]/body[1]/div[20]",
"/html[1]/body[1]/div[23]",
"/html[1]/body[1]/div[26]",
"/html[1]/body[1]/div[29]",
"/html[1]/body[1]/div[32]",
"/html[1]/body[1]/div[33]",
"/html[1]/body[1]/div[34]",
"/html[1]/body[1]/div[35]",
"/html[1]/body[1]/div[3]",
"/html[1]/body[1]/div[4]",
"/html[1]/body[1]/div[7]"
]
}];
}
];
//]]>
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test case</title>
</head>
<body>
<ul role="listbox" tabindex="0" aria-activedescendant="first">
<li id="first" role="option" aria-selected="true">First</li>
<li id="second" role="option" aria-selected="false">Second</li>
<li id="third" role="option" aria-selected="false">Third</li>
</ul>

<script>
UnitTest = {
ruleIds: ["WCAG20_Input_ExplicitLabel"],
results: [
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]",
"aria": "/document[1]/listbox[1]"
},
"reasonId": "Fail_2",
"message": "Form control with \"listbox\" role has no associated label",
"messageArgs": [
"listbox"
],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test case</title>
</head>
<body>
<ul role="listbox" tabindex="0" aria-activedescendant="first" aria-label='my box'>
<li id="first" role="option" aria-selected="true">First</li>
<li id="second" role="option" aria-selected="false">Second</li>
<li id="third" role="option" aria-selected="false">Third</li>
</ul>

<script>
UnitTest = {
ruleIds: ["WCAG20_Input_ExplicitLabel"],
results: [
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]",
"aria": "/document[1]/listbox[1]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test case</title>
</head>
<body>
<ul role='menu' tabindex='0' aria-activedescendant='first'>
<li id='first' role='menuitem' tabindex='-1'>First</li>
<li id='second' role='menuitem' >Second</li>
<li id='third' role='menuitemcheckbox' aria-checked='true'> </li>
</ul>

<script>
UnitTest = {
ruleIds: ["WCAG20_Input_ExplicitLabel"],
results: [
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]/li[3]",
"aria": "/document[1]/menu[1]/menuitemcheckbox[1]"
},
"reasonId": "Fail_2",
"message": "Form control with \"menuitemcheckbox\" role has no associated label",
"messageArgs": [
"menuitemcheckbox"
],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test case</title>
</head>
<body>
<ul role='menu' tabindex='0' aria-activedescendant='first'>
<li id='first' role='menuitem' tabindex='-1'>First</li>
<li id='second' role='menuitem' >Second</li>
<li id='third' role='menuitemcheckbox' aria-checked='true'>Third</li>
</ul>

<script>
UnitTest = {
ruleIds: ["WCAG20_Input_ExplicitLabel"],
results: [
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]/li[3]",
"aria": "/document[1]/menu[1]/menuitemcheckbox[1]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test case</title>
</head>
<body>
<ul role='menu' tabindex='0' aria-activedescendant='first'>
<li id='first' role='menuitemradio' aria-checked='true'>First</li>
<li id='second' role='menuitemradio' aria-checked='false'>Second</li>
<li id='third' role='menuitemradio' aria-checked='false'> </li>
</ul>

<script>
UnitTest = {
ruleIds: ["WCAG20_Input_ExplicitLabel"],
results: [
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]/li[1]",
"aria": "/document[1]/menu[1]/menuitemradio[1]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]/li[2]",
"aria": "/document[1]/menu[1]/menuitemradio[2]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "WCAG20_Input_ExplicitLabel",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/ul[1]/li[3]",
"aria": "/document[1]/menu[1]/menuitemradio[3]"
},
"reasonId": "Fail_2",
"message": "Form control with \"menuitemradio\" role has no associated label",
"messageArgs": [
"menuitemradio"
],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Loading

0 comments on commit dac522d

Please sign in to comment.