Skip to content

Commit a08baf4

Browse files
shunguoydependabot[bot]tombrunetnam-singh
authored
fix(engine): Fix issues related to accessible name concatenation and deprecate aria_search_label_unique rule V4 (#2178)
* Bump path-to-regexp and express in /rule-server (#2128) Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) to 0.1.12 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together. Updates `path-to-regexp` from 0.1.10 to 0.1.12 - [Release notes](https://github.com/pillarjs/path-to-regexp/releases) - [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md) - [Commits](pillarjs/path-to-regexp@v0.1.10...v0.1.12) Updates `express` from 4.21.0 to 4.21.2 - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/4.21.2/History.md) - [Commits](expressjs/express@4.21.0...4.21.2) --- updated-dependencies: - dependency-name: path-to-regexp dependency-type: indirect - dependency-name: express dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Brunet <thbrunet@us.ibm.com> * fix dark mode react portal pop-up (#2138) * fix(extension):Fix reset filter link #1877 (#2136) * reset filter fix * css fix --------- Co-authored-by: Tom Brunet <thbrunet@us.ibm.com> * fix(extension): Don't show full data:text/html content on generated HTML report page (#2140) * truncating url * remove unused import * Adjust tooltip location --------- Co-authored-by: Tom Brunet <thbrunet@us.ibm.com> * chore(extension): carbon package update and use new carbon combobutton #1842 (#2137) * carbon package update and use new carbon combobutton * alignment fix --------- Co-authored-by: Tom Brunet <thbrunet@us.ibm.com> * update the rule logic and add new test cases #2122 * update act mapping #dev-2122-new --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Brunet <thbrunet@us.ibm.com> Co-authored-by: Namrata Singh <nam.singh@ibm.com>
1 parent 968333c commit a08baf4

File tree

6 files changed

+102
-9
lines changed

6 files changed

+102
-9
lines changed

accessibility-checker-engine/src/v4/rules/aria_search_label_unique.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*****************************************************************************/
1313

14-
import { Rule, RuleResult, RuleFail, RuleContext, RulePotential, RuleManual, RulePass, RuleContextHierarchy } from "../api/IRule";
14+
import { Rule, RuleResult, RuleFail, RuleContext, RulePass, RuleContextHierarchy } from "../api/IRule";
1515
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
1616
import { AriaUtil } from "../util/AriaUtil";
1717
import { CommonUtil } from "../util/CommonUtil";
@@ -39,11 +39,19 @@ export const aria_search_label_unique: Rule = {
3939
"group": "Each element with \"search\" role must have a unique label that describes its purpose"
4040
}
4141
},
42-
rulesets: [{
42+
/**
43+
* deprecated the rule on 01/27/2025
44+
* rulesets: [{
4345
"id": ["IBM_Accessibility", "IBM_Accessibility_next", "WCAG_2_1", "WCAG_2_0", "WCAG_2_2"],
4446
"num": ["2.4.1"],
4547
"level": eRulePolicy.VIOLATION,
4648
"toolkitLevel": eToolkitLevel.LEVEL_THREE
49+
}],*/
50+
rulesets: [{
51+
"id": [],
52+
"num": ["2.4.1"],
53+
"level": eRulePolicy.VIOLATION,
54+
"toolkitLevel": eToolkitLevel.LEVEL_THREE
4755
}],
4856
act: [],
4957
run: (context: RuleContext, options?: {}, contextHierarchies?: RuleContextHierarchy): RuleResult | RuleResult[] => {

accessibility-checker-engine/src/v4/rules/label_name_visible.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { FragmentUtil } from "../../v2/checker/accessibility/util/fragment";
1919
import { VisUtil } from "../util/VisUtil";
2020
import { CSSUtil } from "../util/CSSUtil";
2121
import { DOMWalker } from "../../v2/dom/DOMWalker";
22-
import { AccNameUtil } from "../util/AccNameUtil";
2322

2423
export const label_name_visible: Rule = {
2524
id: "label_name_visible",

accessibility-checker-engine/src/v4/rules/meta_viewport_zoomable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export const meta_viewport_zoomable: Rule = {
4545
}],
4646
act: [{
4747
"b4f0c3": {
48-
"Pass_0": "pass",
49-
"Potential_1": "fail"
48+
"pass": "pass",
49+
"potential_zoomable": "fail"
5050
}
5151
}],
5252
run: (context: RuleContext, options?: {}, contextHierarchies?: RuleContextHierarchy): RuleResult | RuleResult[] => {

accessibility-checker-engine/src/v4/util/CommonUtil.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,15 +1207,15 @@ export class CommonUtil {
12071207
if (nw.bEndTag) continue;
12081208
if ((nw.node.nodeType === 1 && (VisUtil.hiddenByDefaultElements.includes(nw.node.nodeName.toLowerCase())) || !VisUtil.isNodeVisible(nw.node) || VisUtil.isElementOffscreen(nw.node as HTMLElement))) {
12091209
if (nw.node.nextSibling) {
1210-
if (nw.node.nextSibling.nodeType === 3 && nw.node.nextSibling.nodeValue !== null)
1211-
text += nw.node.nextSibling.nodeValue;
1210+
if (nw.node.nextSibling.nodeType === 3 && nw.node.nextSibling.nodeValue && nw.node.nextSibling.nodeValue.trim() !== '')
1211+
text += ' ' + nw.node.nextSibling.nodeValue.trim();
12121212
nw.node = nw.node.nextSibling;
12131213
continue;
12141214
} else
12151215
break;
12161216
}
1217-
if (nw.node.nodeType === 3 && nw.node.nodeValue !== null) {
1218-
text += nw.node.nodeValue.trim();
1217+
if (nw.node.nodeType === 3 && nw.node.nodeValue && nw.node.nodeValue.trim() !== '') {
1218+
text += ' ' + nw.node.nodeValue.trim();
12191219
}
12201220
}
12211221
return text.trim();
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Test case</title>
5+
</head>
6+
<body>
7+
<button
8+
aria-expanded="false"
9+
aria-controls="id-:re:"
10+
aria-label="AI Text goes here"
11+
type="button">
12+
<span class="cds--ai-label__text">AI</span>
13+
<span class="cds--ai-label__additional-text">Text goes here</span>
14+
</button>
15+
16+
<script>
17+
UnitTest = {
18+
ruleIds: ["label_name_visible"],
19+
results: [
20+
{
21+
"ruleId": "label_name_visible",
22+
"value": [
23+
"INFORMATION",
24+
"PASS"
25+
],
26+
"path": {
27+
"dom": "/html[1]/body[1]/button[1]",
28+
"aria": "/document[1]/button[1]"
29+
},
30+
"reasonId": "Pass_0",
31+
"message": "Accessible name matches or contains the visible label text",
32+
"messageArgs": [],
33+
"apiArgs": [],
34+
"category": "Accessibility"
35+
}
36+
]
37+
};
38+
</script>
39+
</body>
40+
</html>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Test case</title>
6+
</head>
7+
8+
<body>
9+
<button type="button" id="count-badge-1-button" title="Click here to see notification. 2 Notification available."
10+
aria-label="Click here to see notification. 2 Notification available."> <span> <svg width="24" height="24"
11+
xmlns="http://www.w3.org/2000/svg" aria-hidden="true" color="primary" viewBox="0 0 24 24"
12+
style="width: 24px; height: 24px">
13+
<g fill="none" fill-rule="evenodd">
14+
<path d="M0 0h24v24H0z"></path>
15+
<path
16+
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"
17+
fill="#000"></path>
18+
</g>
19+
</svg><span>2</span></span> Notification</button>
20+
21+
<script>
22+
UnitTest = {
23+
ruleIds: ["label_name_visible"],
24+
results: [
25+
{
26+
"ruleId": "label_name_visible",
27+
"value": [
28+
"INFORMATION",
29+
"PASS"
30+
],
31+
"path": {
32+
"dom": "/html[1]/body[1]/button[1]",
33+
"aria": "/document[1]/button[1]"
34+
},
35+
"reasonId": "Pass_0",
36+
"message": "Accessible name matches or contains the visible label text",
37+
"messageArgs": [],
38+
"apiArgs": [],
39+
"category": "Accessibility"
40+
}
41+
]
42+
};
43+
</script>
44+
</body>
45+
46+
</html>

0 commit comments

Comments
 (0)