Skip to content

Commit

Permalink
Merge pull request #646 from IBMa/ali-deprecating_Rpt_Aria_MultipleGr…
Browse files Browse the repository at this point in the history
…oupRoles_Implicit

Deprecation of rule Rpt_Aria_MultipleGroupRoles_Implicit
  • Loading branch information
ErickRenteria authored Feb 3, 2022
2 parents 3bb5e0d + dac522d commit b4034eb
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,11 @@ let a11yHelp = {
"Fail_1": `${Config.helpRoot}/Rpt_Aria_ArticleRoleLabel_Implicit`
},
// JCH - DONE
"Rpt_Aria_MultipleGroupRoles_Implicit": {
0: `${Config.helpRoot}/Rpt_Aria_MultipleGroupRoles_Implicit`,
"Pass_0": `${Config.helpRoot}/Rpt_Aria_MultipleGroupRoles_Implicit`,
"Fail_1": `${Config.helpRoot}/Rpt_Aria_MultipleGroupRoles_Implicit`
},
// "Rpt_Aria_MultipleGroupRoles_Implicit": {
// 0: `${Config.helpRoot}/Rpt_Aria_MultipleGroupRoles_Implicit`,
// "Pass_0": `${Config.helpRoot}/Rpt_Aria_MultipleGroupRoles_Implicit`,
// "Fail_1": `${Config.helpRoot}/Rpt_Aria_MultipleGroupRoles_Implicit`
// },
// JCH - DONE
"Rpt_Aria_GroupRoleLabel_Implicit": {
0: `${Config.helpRoot}/Rpt_Aria_GroupRoleLabel_Implicit`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,11 @@ let a11yNls = {
"Fail_1": "The element with \"article\" role does not have a label"
},
// JCH - DONE
"Rpt_Aria_MultipleGroupRoles_Implicit": {
0: "Each element with \"group\" role must have a unique label that describes its purpose",
"Pass_0": "Rule Passed",
"Fail_1": "Multiple elements with \"group\" role do not have unique labels"
},
// "Rpt_Aria_MultipleGroupRoles_Implicit": {
// 0: "Each element with \"group\" role must have a unique label that describes its purpose",
// "Pass_0": "Rule Passed",
// "Fail_1": "Multiple elements with \"group\" role do not have unique labels"
// },
// JCH - DONE
"Rpt_Aria_GroupRoleLabel_Implicit": {
0: "An element with \"group\" role should have a unique label that describes its purpose",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,40 +834,48 @@ let a11yRulesLabeling: Rule[] = [
}
},

{
/**
* Description: Triggers if multiple group roles are present and they don't have unique labels
* Also, consider <details> element which has implicit 'group' role
* Origin: CI162 Web checklist checkpoint 2.4a
*/
id: "Rpt_Aria_MultipleGroupRoles_Implicit",
context: "aria:group",
run: (context: RuleContext, options?: {}): RuleResult | RuleResult[] => {
const ruleContext = context["dom"].node as Element;

// Consider the Check Hidden Content setting that is set by the rules
// Also, consider Implicit role checking.
let landmarks = RPTUtil.getElementsByRoleHidden(ruleContext.ownerDocument, "group", true, true);
if (landmarks.length === 0 || landmarks.length === 1) {
return null;
}

let dupes = RPTUtil.getCache(ruleContext.ownerDocument, "Rpt_Aria_MultipleGroupRoles_Implicit", null);
if (!dupes) {
dupes = RPTUtil.findAriaLabelDupes(landmarks);
RPTUtil.setCache(ruleContext.ownerDocument, "Rpt_Aria_MultipleGroupRoles_Implicit", dupes);
}
let myLabel = RPTUtil.getAriaLabel(ruleContext);
let passed = myLabel === "" || !(myLabel in dupes) || dupes[myLabel] <= 1;

//return new ValidationResult(passed, ruleContext, '', '', [ myLabel ]);
if (!passed) {
return RuleFail("Fail_1", [myLabel]);
} else {
return RulePass("Pass_0");
}
}
},
/** --------------------------------------------------------------------------------------------
* DEPRECATED: This rule is being deprecated and replaced by 2 separate rules that are more
* targeted.
* 1) landmark_name_unique
* 2) group_withInputs_hasName
* The reasoning for this was we were accidentally catching groups that were valid. Such as
* groups that might have the same name but had structurally ways to reach them. So they were
* disambiguated by structure nested parent hierarchy.
* --------------------------------------------------------------------------------------------
* Description: Triggers if multiple group roles are present and they don't have unique labels
* Also, consider <details> element which has implicit 'group' role
* Origin: CI162 Web checklist checkpoint 2.4a
*/
// {
// id: "Rpt_Aria_MultipleGroupRoles_Implicit",
// context: "aria:group",
// run: (context: RuleContext, options?: {}): RuleResult | RuleResult[] => {
// const ruleContext = context["dom"].node as Element;

// // Consider the Check Hidden Content setting that is set by the rules
// // Also, consider Implicit role checking.
// let landmarks = RPTUtil.getElementsByRoleHidden(ruleContext.ownerDocument, "group", true, true);
// if (landmarks.length === 0 || landmarks.length === 1) {
// return null;
// }

// let dupes = RPTUtil.getCache(ruleContext.ownerDocument, "Rpt_Aria_MultipleGroupRoles_Implicit", null);
// if (!dupes) {
// dupes = RPTUtil.findAriaLabelDupes(landmarks);
// RPTUtil.setCache(ruleContext.ownerDocument, "Rpt_Aria_MultipleGroupRoles_Implicit", dupes);
// }
// let myLabel = RPTUtil.getAriaLabel(ruleContext);
// let passed = myLabel === "" || !(myLabel in dupes) || dupes[myLabel] <= 1;

// //return new ValidationResult(passed, ruleContext, '', '', [ myLabel ]);
// if (!passed) {
// return RuleFail("Fail_1", [myLabel]);
// } else {
// return RulePass("Pass_0");
// }
// }
// },


{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,12 @@ let a11yRulesets: Ruleset[] = [
level: eRulePolicy.VIOLATION,
toolkitLevel: eToolkitLevel.LEVEL_THREE
},
{
id: "Rpt_Aria_MultipleGroupRoles_Implicit",
level: eRulePolicy.VIOLATION,
toolkitLevel: eToolkitLevel.LEVEL_THREE
},
// DEPRECATED
// {
// id: "Rpt_Aria_MultipleGroupRoles_Implicit",
// level: eRulePolicy.VIOLATION,
// toolkitLevel: eToolkitLevel.LEVEL_THREE
// },
{
id: "Rpt_Aria_MultipleContentinfoInSiblingSet_Implicit",
level: eRulePolicy.VIOLATION,
Expand Down Expand Up @@ -1945,11 +1946,12 @@ let a11yRulesets: Ruleset[] = [
level: eRulePolicy.VIOLATION,
toolkitLevel: eToolkitLevel.LEVEL_THREE
},
{
id: "Rpt_Aria_MultipleGroupRoles_Implicit",
level: eRulePolicy.VIOLATION,
toolkitLevel: eToolkitLevel.LEVEL_THREE
},
// DEPRECATED
// {
// id: "Rpt_Aria_MultipleGroupRoles_Implicit",
// level: eRulePolicy.VIOLATION,
// toolkitLevel: eToolkitLevel.LEVEL_THREE
// },
{
id: "Rpt_Aria_MultipleContentinfoInSiblingSet_Implicit",
level: eRulePolicy.VIOLATION,
Expand Down Expand Up @@ -3080,11 +3082,12 @@ let a11yRulesets: Ruleset[] = [
level: eRulePolicy.VIOLATION,
toolkitLevel: eToolkitLevel.LEVEL_THREE
},
{
id: "Rpt_Aria_MultipleGroupRoles_Implicit",
level: eRulePolicy.VIOLATION,
toolkitLevel: eToolkitLevel.LEVEL_THREE
},
// DEPRECATED
// {
// id: "Rpt_Aria_MultipleGroupRoles_Implicit",
// level: eRulePolicy.VIOLATION,
// toolkitLevel: eToolkitLevel.LEVEL_THREE
// },
{
id: "Rpt_Aria_MultipleContentinfoInSiblingSet_Implicit",
level: eRulePolicy.VIOLATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -53,5 +53,6 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -51,5 +51,6 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -47,7 +47,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
failedXpaths: []
}];
//]]>
</script>
</script> -->
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -51,5 +51,6 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h2 id="hd1">Another heading to be used as landmark label</h2>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -51,7 +51,7 @@ <h2 id="hd1">Another heading to be used as landmark label</h2>
]
}];
//]]>
</script>
</script> -->
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h2 id="hd4">Another heading to be used as landmark label - hd4</h2>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -55,7 +55,7 @@ <h2 id="hd4">Another heading to be used as landmark label - hd4</h2>
failedXpaths: []
}];
//]]>
</script>
</script> -->
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -51,5 +51,6 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -51,5 +51,6 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3 id="hd1">Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -51,5 +51,6 @@ <h3 id="hd1">Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>

<a name="navskip"></a>

<script type="text/javascript">
<!-- <script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
Expand All @@ -50,5 +50,6 @@ <h3>Multiple landmarks of the same type must have unique labels</h3>
}
];
//]]>
</script></body>
</script> -->
</body>
</html>

0 comments on commit b4034eb

Please sign in to comment.