Skip to content

Commit

Permalink
fix(engine): Fix issues related to accessible name concatenation and …
Browse files Browse the repository at this point in the history
…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] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Brunet <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* update the rule logic and add new test cases #2122

* update act mapping #dev-2122-new

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Brunet <[email protected]>
Co-authored-by: Namrata Singh <[email protected]>
  • Loading branch information
4 people authored Feb 4, 2025
1 parent 968333c commit a08baf4
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 a08baf4

Please sign in to comment.