Skip to content

Commit

Permalink
Merge branch 'dev-2122-new' into dev-2122-v4
Browse files Browse the repository at this point in the history
Merge from dev-2122-new to dev-2122-v4
  • Loading branch information
shunguoy committed Jan 28, 2025
2 parents 981a467 + b3a71d8 commit fb8b7dc
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
limitations under the License.
*****************************************************************************/

import { Rule, RuleResult, RuleFail, RuleContext, RulePotential, RuleManual, RulePass, RuleContextHierarchy } from "../api/IRule";
import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
Expand Down Expand Up @@ -39,11 +39,19 @@ export const aria_search_label_unique: Rule = {
"group": "Each element with \"search\" role must have a unique label that describes its purpose"
}
},
rulesets: [{
/**
* deprecated the rule on 01/27/2025
* rulesets: [{
"id": ["IBM_Accessibility", "IBM_Accessibility_next", "WCAG_2_1", "WCAG_2_0", "WCAG_2_2"],
"num": ["2.4.1"],
"level": eRulePolicy.VIOLATION,
"toolkitLevel": eToolkitLevel.LEVEL_THREE
}],*/
rulesets: [{
"id": [],
"num": ["2.4.1"],
"level": eRulePolicy.VIOLATION,
"toolkitLevel": eToolkitLevel.LEVEL_THREE
}],
act: [],
run: (context: RuleContext, options?: {}, contextHierarchies?: RuleContextHierarchy): RuleResult | RuleResult[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { FragmentUtil } from "../../v2/checker/accessibility/util/fragment";
import { VisUtil } from "../util/VisUtil";
import { CSSUtil } from "../util/CSSUtil";
import { DOMWalker } from "../../v2/dom/DOMWalker";
import { AccNameUtil } from "../util/AccNameUtil";

export const label_name_visible: Rule = {
id: "label_name_visible",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const meta_viewport_zoomable: Rule = {
}],
act: [{
"b4f0c3": {
"Pass_0": "pass",
"Potential_1": "fail"
"pass": "pass",
"potential_zoomable": "fail"
}
}],
run: (context: RuleContext, options?: {}, contextHierarchies?: RuleContextHierarchy): RuleResult | RuleResult[] => {
Expand Down
8 changes: 4 additions & 4 deletions accessibility-checker-engine/src/v4/util/CommonUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,15 +1207,15 @@ export class CommonUtil {
if (nw.bEndTag) continue;
if ((nw.node.nodeType === 1 && (VisUtil.hiddenByDefaultElements.includes(nw.node.nodeName.toLowerCase())) || !VisUtil.isNodeVisible(nw.node) || VisUtil.isElementOffscreen(nw.node as HTMLElement))) {
if (nw.node.nextSibling) {
if (nw.node.nextSibling.nodeType === 3 && nw.node.nextSibling.nodeValue !== null)
text += nw.node.nextSibling.nodeValue;
if (nw.node.nextSibling.nodeType === 3 && nw.node.nextSibling.nodeValue && nw.node.nextSibling.nodeValue.trim() !== '')
text += ' ' + nw.node.nextSibling.nodeValue.trim();
nw.node = nw.node.nextSibling;
continue;
} else
break;
}
if (nw.node.nodeType === 3 && nw.node.nodeValue !== null) {
text += nw.node.nodeValue.trim();
if (nw.node.nodeType === 3 && nw.node.nodeValue && nw.node.nodeValue.trim() !== '') {
text += ' ' + nw.node.nodeValue.trim();
}
}
return text.trim();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test case</title>
</head>
<body>
<button
aria-expanded="false"
aria-controls="id-:re:"
aria-label="AI Text goes here"
type="button">
<span class="cds--ai-label__text">AI</span>
<span class="cds--ai-label__additional-text">Text goes here</span>
</button>

<script>
UnitTest = {
ruleIds: ["label_name_visible"],
results: [
{
"ruleId": "label_name_visible",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/button[1]",
"aria": "/document[1]/button[1]"
},
"reasonId": "Pass_0",
"message": "Accessible name matches or contains the visible label text",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>Test case</title>
</head>

<body>
<button type="button" id="count-badge-1-button" title="Click here to see notification. 2 Notification available."
aria-label="Click here to see notification. 2 Notification available."> <span> <svg width="24" height="24"
xmlns="http://www.w3.org/2000/svg" aria-hidden="true" color="primary" viewBox="0 0 24 24"
style="width: 24px; height: 24px">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h24v24H0z"></path>
<path
d="M16 16.5H8v-6C8 8.02 9.51 6 12 6s4 2.02 4 4.5v6zm2 0v-6c0-3.07-1.63-5.64-4.5-6.32V3.5c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 4.86 6 7.42 6 10.5v6H4.99a.99.99 0 00-.99.99v.02c0 .547.443.99.99.99h14.02a.99.99 0 00.99-.99v-.02a.99.99 0 00-.99-.99H18zm-6 5c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2z"
fill="#000"></path>
</g>
</svg><span>2</span></span> Notification</button>

<script>
UnitTest = {
ruleIds: ["label_name_visible"],
results: [
{
"ruleId": "label_name_visible",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/button[1]",
"aria": "/document[1]/button[1]"
},
"reasonId": "Pass_0",
"message": "Accessible name matches or contains the visible label text",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>

</html>

0 comments on commit fb8b7dc

Please sign in to comment.