Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixrule(a_text_purpose, meta_viewport_zoomable, widget_tabbable_exists, widget_tabbable_single): Re-mapping WCAG SC and help references #1899

Merged
merged 8 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ <h3 id="ruleMessage"></h3>
### About this requirement

* [IBM 1.4.4 Resize text](https://www.ibm.com/able/requirements/requirements/#1_4_4)
* [IBM 1.4.10 Reflow](https://www.ibm.com/able/requirements/requirements/#1_4_10)
* [ACT rule: meta viewport allows for zoom](https://act-rules.github.io/rules/b4f0c3)

### Who does this affect?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ <h3 id="ruleMessage"></h3>

The primary keyboard navigation convention uses `Tab` and `Shift+Tab` keys to move focus from one UI component to another.
Other keys (primarily the arrow keys) move focus within components comprised of multiple focusable elements.
Authors must follow this convention and provide no more than one tab stop per component (providing keyboard focus).
Authors must follow this convention and provide no more than one tab stop per component (providing keyboard focus) and insure the keyboard tab sequence is logical.
In addition, the keyboard operations should be consistent with common keyboard interface conventions described in the [ARIA Patterns](https://www.w3.org/WAI/ARIA/apg/patterns/), especially for assistive technology users.

<!-- This is where the code snippet is injected -->
<div id="locSnippet"></div>
Expand All @@ -68,7 +69,11 @@ <h3 id="ruleMessage"></h3>
### About this requirement

* [IBM 2.1.1 Keyboard](https://www.ibm.com/able/requirements/requirements/#2_1_1)
* [IBM 2.4.3 Focus Order](https://www.ibm.com/able/requirements/requirements/#2_4_3)
* [ARIA practices - Patterns](https://www.w3.org/WAI/ARIA/apg/patterns/)
* [ARIA practices - Developing a Keyboard Interface](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/)
* [Verify - Check tab or navigation order](https://www.ibm.com/able/toolkit/verify/manual/#tabnavorder)
* [Verify - Maintaining user's point of regard](https://www.ibm.com/able/toolkit/verify/manual/#pointofregard)

### Who does this affect?

Expand Down
18 changes: 9 additions & 9 deletions accessibility-checker-engine/src/v4/rules/a_text_purpose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*****************************************************************************/

import { ARIAMapper } from "../../v2/aria/ARIAMapper";
import { Rule, RuleResult, RuleFail, RuleContext, RulePotential, RuleManual, RulePass, RuleContextHierarchy } from "../api/IRule";
import { Rule, RuleResult, RuleFail, RuleContext, RulePass } from "../api/IRule";
import { RPTUtil } from "../../v2/checker/accessibility/util/legacy";
import { VisUtil } from "../../v2/dom/VisUtil";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
Expand All @@ -23,22 +23,22 @@ export let a_text_purpose: Rule = {
context: "aria:link,aria:doc-biblioref",
refactor: {
"WCAG20_A_HasText": {
"Pass_0": "Pass_0",
"Fail_1": "Fail_1"
"Pass_0": "pass",
"Fail_1": "fail_acc_name"
}
},
help: {
"en-US": {
"group": `a_text_purpose.html`,
"Pass_0": `a_text_purpose.html`,
"Fail_1": `a_text_purpose.html`
"pass": `a_text_purpose.html`,
"fail_acc_name": `a_text_purpose.html`
}
},
messages: {
"en-US": {
"group": "Hyperlinks must have an accessible name for their purpose",
"Pass_0": "Hyperlink has a description of its purpose",
"Fail_1": "Hyperlink has no link text, label or image with a text alternative"
"pass": "Hyperlink has a description of its purpose",
"fail_acc_name": "Hyperlink has no link text, label or image with a text alternative"
}
},
rulesets: [{
Expand All @@ -62,9 +62,9 @@ export let a_text_purpose: Rule = {
ARIAMapper.computeName(ruleContext).trim().length > 0
|| RPTUtil.nonTabableChildCheck(ruleContext);
if (!passed) {
return RuleFail("Fail_1");
return RuleFail("fail_acc_name");
} else {
return RulePass("Pass_0");
return RulePass("pass");
}
}
}
27 changes: 10 additions & 17 deletions accessibility-checker-engine/src/v4/rules/meta_viewport_zoomable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,37 @@
limitations under the License.
*****************************************************************************/

import { Rule, RuleResult, RuleFail, RuleContext, RulePotential, RuleManual, RulePass, RuleContextHierarchy } from "../api/IRule";
import { Rule, RuleResult, RuleContext, RulePotential, RulePass, RuleContextHierarchy } from "../api/IRule";
import { eRulePolicy, eToolkitLevel } from "../api/IRule";
import { RPTUtil } from "../../v2/checker/accessibility/util/legacy";

export let meta_viewport_zoomable: Rule = {
id: "meta_viewport_zoomable",
context: "dom:meta[name][content]",
refactor: {
"meta_viewport_zoom": {
"Pass_0": "Pass_0",
"Potential_1": "Potential_1"
"Pass_0": "pass",
"Potential_1": "potential_zoomable"
}
},
help: {
"en-US": {
"group": "meta_viewport_zoomable.html",
"Pass_0": "meta_viewport_zoomable.html",
"Potential_1": "meta_viewport_zoomable.html"
"pass": "meta_viewport_zoomable.html",
"potential_zoomable": "meta_viewport_zoomable.html"
}
},
messages: {
"en-US": {
"group": "The 'meta[name=viewport]' should not prevent the browser zooming the content",
"Pass_0": "The 'meta[name=viewport]' does not prevent the browser zooming the content",
"Potential_1": "Confirm the 'meta[name=viewport]' with \"{0}\" can be zoomed by user"
"pass": "The 'meta[name=viewport]' does not prevent the browser zooming the content",
"potential_zoomable": "Confirm the 'meta[name=viewport]' with \"{0}\" can be zoomed by user"
}
},
rulesets: [{
"id": ["IBM_Accessibility", "WCAG_2_1", "WCAG_2_0", "WCAG_2_2"],
"num": ["1.4.4"],
"level": eRulePolicy.RECOMMENDATION,
"toolkitLevel": eToolkitLevel.LEVEL_THREE
},
{
"id": ["IBM_Accessibility", "WCAG_2_1", "WCAG_2_2"],
"num": ["1.4.10"],
"level": eRulePolicy.RECOMMENDATION,
"toolkitLevel": eToolkitLevel.LEVEL_THREE
}],
act: [{
"b4f0c3": {
Expand Down Expand Up @@ -107,12 +100,12 @@ export let meta_viewport_zoomable: Rule = {

// user-scalable is not set to 'yes', ignore maximum_scale
if (user_scale_value !== 'yes') {
return RulePotential("Potential_1", [user_msg]);
return RulePotential("potential_zoomable", [user_msg]);
}
// user-scalable is 'yes', but maximum_scale is too small
if (maximum_scale < 2.0) {
return RulePotential("Potential_1", [max_msg]);
return RulePotential("potential_zoomable", [max_msg]);
}
return RulePass("Pass_0");
return RulePass("pass");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export let widget_tabbable_exists: Rule = {
},
rulesets: [{
"id": ["IBM_Accessibility", "WCAG_2_1", "WCAG_2_0", "WCAG_2_2"],
"num": ["2.4.3"],
"num": ["2.1.1"],
"level": eRulePolicy.VIOLATION,
"toolkitLevel": eToolkitLevel.LEVEL_ONE
}],
Expand Down Expand Up @@ -87,4 +87,4 @@ export let widget_tabbable_exists: Rule = {
let passed = count >= 1;
return passed ? RulePass("pass") : RulePotential("fail_no_tabbable", [role]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export let widget_tabbable_single: Rule = {
},
rulesets: [{
"id": ["IBM_Accessibility", "WCAG_2_1", "WCAG_2_0", "WCAG_2_2"],
"num": ["2.4.3"],
"num": ["2.1.1", "2.4.3"],
"level": eRulePolicy.VIOLATION,
"toolkitLevel": eToolkitLevel.LEVEL_ONE
}],
Expand Down Expand Up @@ -79,4 +79,4 @@ export let widget_tabbable_single: Rule = {
setCache(ruleContext, "widget_tabbable_single", "fail_multiple_tabbable");
return passed ? RulePass("pass") : RulePotential("fail_multiple_tabbable", [role]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h2 tabindex="0">
"dom": "/html[1]/body[1]/a[1]",
"aria": "/document[1]/link[1]"
},
"reasonId": "Fail_1",
"reasonId": "fail_acc_name",
//"message": "Hyperlink is missing link text or an image with alt text.",
"message": "Hyperlink has no link text, label or image with a text alternative",
"messageArgs": [],
Expand All @@ -98,7 +98,7 @@ <h2 tabindex="0">
"dom": "/html[1]/body[1]/a[2]",
"aria": "/document[1]/link[2]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
//"message": "Hyperlink contains content that is readable by assistive technologies.",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
Expand All @@ -113,7 +113,7 @@ <h2 tabindex="0">
"dom": "/html[1]/body[1]/a[3]",
"aria": "/document[1]/link[3]"
},
"reasonId": "Fail_1",
"reasonId": "fail_acc_name",
//"message": "Hyperlink is missing link text or an image with alt text.",
"message": "Hyperlink has no link text, label or image with a text alternative",
"messageArgs": [],
Expand All @@ -128,7 +128,7 @@ <h2 tabindex="0">
"dom": "/html[1]/body[1]/a[4]",
"aria": "/document[1]/link[4]"
},
"reasonId": "Fail_1",
"reasonId": "fail_acc_name",
//"message": "Hyperlink is missing link text or an image with alt text.",
"message": "Hyperlink has no link text, label or image with a text alternative",
"messageArgs": [],
Expand All @@ -143,7 +143,7 @@ <h2 tabindex="0">
"dom": "/html[1]/body[1]/a[5]",
"aria": "/document[1]/link[5]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
//"message": "Hyperlink contains content that is readable by assistive technologies.",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"dom": "/html[1]/body[1]/main[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand All @@ -58,7 +58,7 @@
"dom": "/html[1]/body[1]/main[1]/div[2]/#document-fragment[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[2]"
},
"reasonId": "Fail_1",
"reasonId": "fail_acc_name",
"message": "Hyperlink has no link text, label or image with a text alternative",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dom": "/html[1]/body[1]/main[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand All @@ -59,7 +59,7 @@
"dom": "/html[1]/body[1]/main[1]/div[2]/#document-fragment[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[2]"
},
"reasonId": "Fail_1",
"reasonId": "fail_acc_name",
"message": "Hyperlink has no link text, label or image with a text alternative",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dom": "/html[1]/body[1]/main[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand All @@ -60,7 +60,7 @@
"dom": "/html[1]/body[1]/main[1]/div[2]/#document-fragment[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[2]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dom": "/html[1]/body[1]/main[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand All @@ -60,7 +60,7 @@
"dom": "/html[1]/body[1]/main[1]/div[2]/#document-fragment[1]/div[1]/a[1]",
"aria": "/document[1]/main[1]/link[2]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"dom": "/html[1]/body[1]/a[1]",
"aria": "/document[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
//"message": "Hyperlink contains content that is readable by assistive technologies.",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
Expand All @@ -70,7 +70,7 @@
"dom": "/html[1]/body[1]/a[2]",
"aria": "/document[1]/link[2]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
//"message": "Hyperlink contains content that is readable by assistive technologies.",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1>Test page</h1>
"dom": "/html[1]/body[1]/main[1]/my-link[1]/#document-fragment[1]/a[1]",
"aria": "/document[1]/main[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"dom": "/html[1]/body[1]/header[1]/a[1]",
"aria": "/document[1]/banner[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand All @@ -73,7 +73,7 @@
"dom": "/html[1]/body[1]/header[2]/a[1]",
"aria": "/document[1]/banner[2]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1>Test page</h1>
"dom": "/html[1]/body[1]/main[1]/my-link[1]/#document-fragment[1]/a[1]",
"aria": "/document[1]/main[1]/link[1]"
},
"reasonId": "Pass_0",
"reasonId": "pass",
"message": "Hyperlink has a description of its purpose",
"messageArgs": [],
"apiArgs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"dom": "/html[1]/head[1]/meta[2]",
"aria": "/document[1]"
},
"reasonId": "Potential_1",
"reasonId": "potential_zoomable",
"message": "Confirm the 'meta[name=viewport]' with \"maximum-scale=1.0\" can be zoomed by user",
"messageArgs": [
"maximum-scale=1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dom": "/html[1]/head[1]/meta[2]",
"aria": "/document[1]"
},
"reasonId": "Potential_1",
"reasonId": "potential_zoomable",
"message": "Confirm the 'meta[name=viewport]' with \" maximum-scale=1.5\" can be zoomed by user",
"messageArgs": [
" maximum-scale=1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dom": "/html[1]/head[1]/meta[2]",
"aria": "/document[1]"
},
"reasonId": "Potential_1",
"reasonId": "potential_zoomable",
"message": "Confirm the 'meta[name=viewport]' with \"maximum-scale=ok\" can be zoomed by user",
"messageArgs": [
"maximum-scale=ok"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dom": "/html[1]/head[1]/meta[2]",
"aria": "/document[1]"
},
"reasonId": "Potential_1",
"reasonId": "potential_zoomable",
"message": "Confirm the 'meta[name=viewport]' with \"user-scalable=no\" can be zoomed by user",
"messageArgs": [
"user-scalable=no"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"dom": "/html[1]/head[1]/meta[2]",
"aria": "/document[1]"
},
"reasonId": "Potential_1",
"reasonId": "potential_zoomable",
"message": "Confirm the 'meta[name=viewport]' with \"maximum-scale=yes\" can be zoomed by user",
"messageArgs": [
"maximum-scale=yes"
Expand Down