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

ARIA 1.2 and HTML-ARIA 1.0 updates #414

Merged
merged 56 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
94ba2ef
Work in progress:
carmacleod Apr 20, 2021
df80acc
update roleType to match aria role categories
carmacleod Apr 20, 2021
268a6fd
change aria-hidden from boolean to true/false/undefined nmtoken
carmacleod Apr 21, 2021
70025a1
Add field for deprecated roles
carmacleod Apr 21, 2021
227c8da
Add comments to think about how to handle elementsAllowedDisabled/Req…
carmacleod Apr 22, 2021
6e7e42c
Update documentConformanceRequirement data as per HTML-ARIA spec
carmacleod Apr 30, 2021
1afcfa1
Update documentConformanceRequirementSpecialTags data as per HTML-ARI…
carmacleod May 4, 2021
064ffab
Add td, th, tr to documentConformanceRequirementSpecialTags data
carmacleod May 4, 2021
804f3af
Update logic that uses documentConformanceRequirementSpecialTags
carmacleod May 5, 2021
59026e6
Look up ancestor by both explicit and implied role
carmacleod May 7, 2021
d56e1fa
Add support for name prohibited, but comment out for now
carmacleod May 7, 2021
4d69020
update ariaAttributeRoleDefaults
carmacleod May 7, 2021
5a5a32e
Fix typos
carmacleod May 10, 2021
4602cfc
Fix basic exceptions
tombrunet May 12, 2021
b82777f
Fix separator testcase
tombrunet May 15, 2021
99bf366
Handling of sections with names
tombrunet May 15, 2021
a828396
Handling of sections with names
tombrunet May 15, 2021
f30bde5
Merge branch 'aria-1.2-updates' of https://github.com/IBMa/equal-acce…
tombrunet May 15, 2021
02f2c7f
Undo bad commit to karma conf
tombrunet May 15, 2021
3139511
Fix figcaption testcase
tombrunet May 15, 2021
42945a3
Update testcase - item still a violation, but for a different rule
tombrunet May 15, 2021
6683147
No longer invalid
tombrunet May 15, 2021
a62dd4f
menuitem deprecated
tombrunet May 15, 2021
faa597f
update form to use ARIAMapper.computeName instead of RPTUtil.hasAriaL…
carmacleod May 16, 2021
8e02898
img special cases are now handled in getElementAriaProperty
carmacleod May 16, 2021
da5b4f0
only declare name once
carmacleod May 16, 2021
3513c82
Fix ValidAttribute test
carmacleod May 16, 2021
4da38cb
Fix radioNoInnerText test case
carmacleod May 16, 2021
018ed44
Fix radioHasAriaLabel test
carmacleod May 16, 2021
4376c0b
Add missing h1-6 to documentConformanceRequirement
carmacleod May 16, 2021
a7745c6
Fix InValidRoleInvalidAttribute test
carmacleod May 16, 2021
6911e7b
Fix hgroup_element_test
carmacleod May 16, 2021
5a75a6e
Fix h1 in InValidRoleSpecifiedMultiple
carmacleod May 16, 2021
1794599
Fix In[v]alidAttribute test
carmacleod May 16, 2021
006e97c
Fix radioHasInnerText and radioHasTitle tests
carmacleod May 16, 2021
9f5d59f
Fix area_element_test
carmacleod May 16, 2021
56e3bc2
Fix cell_role_test
carmacleod May 16, 2021
2d18508
Fix iframe_test
carmacleod May 16, 2021
cc55c4e
Fix canvas_element_test
carmacleod May 16, 2021
eee8610
Fix figure mapping and presentation role
tombrunet May 18, 2021
e7e3694
Fix testcase
tombrunet May 18, 2021
c5d66a6
Fix testcase
tombrunet May 18, 2021
f69cc8c
Fix testcase
tombrunet May 18, 2021
331fe1d
Tweak testcase
tombrunet May 18, 2021
687550e
Update testcase
tombrunet May 18, 2021
f6afc05
test checked by different rule
tombrunet May 18, 2021
f48a811
Case handled by another rule
tombrunet May 18, 2021
054baec
Update testcase
tombrunet May 18, 2021
8c63d75
Update testcase
tombrunet May 18, 2021
9374fe7
Update testcase
tombrunet May 18, 2021
950978b
Update testcases
tombrunet May 18, 2021
3411ea1
Update testcase
tombrunet May 18, 2021
2df7204
Merge branch 'master' into aria-1.2-updates
tombrunet May 18, 2021
454fef0
Don't require accessible name on tooltip
carmacleod May 19, 2021
eef787a
Tweak to Rpt_Aria_WidgetLabels_Implicit
tombrunet May 19, 2021
ddd84df
Merge branch 'aria-1.2-updates' of https://github.com/IBMa/equal-acce…
tombrunet May 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,210 changes: 764 additions & 446 deletions accessibility-checker-engine/src/v2/aria/ARIADefinitions.ts

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion accessibility-checker-engine/src/v2/aria/ARIAMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ export class ARIAMapper extends CommonMapper {
return null;
}
if (elem.hasAttribute("role") && elem.getAttribute("role").trim().length > 0) {
return elem.getAttribute("role").trim();
let retVal = elem.getAttribute("role").trim();
if (retVal === "presentation" || retVal === "none") return null;
return retVal;
}

let nodeName = elem.nodeName.toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,18 +1275,9 @@ let a11yRulesAria: Rule[] = [{
}
}
} else if (allowedRoles.indexOf("any") > -1) {
//First check special case: <img> with nonempty alt only allows 'any' except 'presentation/none'
if (tagName === "img" && RPTUtil.attributeNonEmpty(ruleContext, "alt") &&
(roles[i] === "presentation" || roles[i] === "none")) {
if (roleTokens.indexOf(roles[i]) === -1) {
roleTokens.push(roles[i]);
passed = false;
}
} else
// Then check the normal case
if (permittedRoles.indexOf(roles[i]) === -1) {
permittedRoles.push(roles[i]);
}
if (permittedRoles.indexOf(roles[i]) === -1) {
permittedRoles.push(roles[i]);
}
}
} // for loop

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Rule, RuleResult, RuleFail, RuleContext, RulePotential, RuleManual, Rul
import { RPTUtil } from "../util/legacy";
import { ARIADefinitions } from "../../../aria/ARIADefinitions";
import { FragmentUtil } from "../util/fragment";
import { DOMUtil } from "../../../dom/DOMUtil";

let a11yRulesLabeling: Rule[] = [
{
Expand Down Expand Up @@ -758,15 +759,20 @@ let a11yRulesLabeling: Rule[] = [
}

let passed = true;
let prohibited = false;
let designPatterns = ARIADefinitions.designPatterns;
//get attribute roles as well as implicit roles.
let roles = RPTUtil.getRoles(ruleContext, true);
let numWidgetsTested = 0;

let interactiveRoleTypes = ["widget", "liveRegion", "window"];
for (let i = 0, length = roles.length; passed && i < length; ++i) {

let pattern = designPatterns[roles[i]];
if (pattern && pattern.nameRequired && pattern.roleType && pattern.roleType == "widget") {
if (pattern
&& pattern.nameRequired
&& pattern.roleType
&& interactiveRoleTypes.includes(pattern.roleType))
{
++numWidgetsTested;

// All widgets may have an author supplied accessible name.
Expand All @@ -777,13 +783,21 @@ let a11yRulesLabeling: Rule[] = [
if (!passed && pattern.nameFrom && pattern.nameFrom.indexOf("contents") >= 0) {

// See if widget's accessible name is supplied by element's inner text
// nameFrom: ["author", "content"]
// nameFrom: ["author", "contents"]
passed = RPTUtil.hasInnerContentOrAlt(ruleContext);
}

if (!passed) { // check if it has implicit label, like <label><input ....>abc </label>
passed = RPTUtil.hasImplicitLabel(ruleContext);
}

if (!passed && ruleContext.tagName.toLowerCase() === "img" && !ruleContext.hasAttribute("role") && ruleContext.hasAttribute("alt")) {
passed = DOMUtil.cleanWhitespace(ruleContext.getAttribute("alt")).trim().length > 0;
}

if (pattern.nameFrom.indexOf("prohibited") >= 0) {
prohibited = true;
}
}
}
//return new ValidationResult(passed, [ruleContext], '', '', []);
Expand All @@ -792,7 +806,12 @@ let a11yRulesLabeling: Rule[] = [
} else if (!passed) {
return RuleFail("Fail_1");
} else {
return RulePass("Pass_0");
//TODO
// if (prohibited) {
// return RuleFail("Fail_2");
// } else {
return RulePass("Pass_0");
// }
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let a11yRulesCombobox: Rule[] = [
}

let tagName = ruleContext.tagName.toLowerCase();
let expanded = RPTUtil.getAriaAttribute(ruleContext, "aria-expanded").trim().toLowerCase() === "true";
let expanded = (RPTUtil.getAriaAttribute(ruleContext, "aria-expanded") || "").trim().toLowerCase() === "true";
let editable = tagName === "input" && (!ruleContext.hasAttribute("type") || ruleContext.getAttribute("type").toLowerCase() === "text");

let key = context["dom"].rolePath;
Expand Down
Loading