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(aria_attribute_allowed, aria_semantics_role)> disallow aria-hidden on body element and add support for the new search element #1407

Merged
merged 5 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions accessibility-checker-engine/src/v2/aria/ARIADefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,7 @@ export class ARIADefinitions {
"body": {
implicitRole: ["generic"],
validRoles: null,
otherDisallowedAriaAttributes: ['aria-hidden'],
globalAriaAttributesValid: true
},
"br": {
Expand Down Expand Up @@ -2051,6 +2052,11 @@ export class ARIADefinitions {
validRoles: null,
globalAriaAttributesValid: false
},
"search": {
implicitRole: ['search'],
validRoles: ['search', 'form', 'group', 'none', 'presentation', 'region'],
globalAriaAttributesValid: true
},
"slot": {
implicitRole: null,
validRoles: null,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Sandbox</title>
<meta charset="UTF-8" />
</head>

<body aria-hidden="true">
<main>
<h1>Test page</h1>
</main>
<script>
UnitTest = {
ruleIds: ["aria_attribute_allowed"],
results: [
{
"ruleId": "aria_attribute_allowed",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]",
"aria": "/document[1]/generic[1]"
},
"reasonId": "Fail_invalid_implicit_role_attr",
"message": "The ARIA attributes \"aria-hidden\" are not valid for the element <body> with implicit ARIA role \"generic\"",
"messageArgs": [
"aria-hidden",
"body",
"generic"
],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Sandbox</title>
<meta charset="UTF-8" />
</head>

<body>
<main>
<search>
<label for=s>Site</label>
<input type=search id=s>
<button>Go!</button>
</search>
<search role="search" aria-checked="true"> </search>
<search role="alert" > </search>
<search role="form" aria-atomic="true"> </search>
</main>
<script>
UnitTest = {
ruleIds: ["aria_attribute_allowed", "aria_semantics_role", "aria_role_redundant"],
results: [
{
"ruleId": "aria_role_redundant",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[2]",
"aria": "/document[1]/main[1]/search[2]"
},
"reasonId": "fail_redundant",
"message": "The explicitly-assigned ARIA role \"search\" is redundant with the implicit role of the element <search>",
"messageArgs": [
"search",
"search"
],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_semantics_role",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[2]",
"aria": "/document[1]/main[1]/search[2]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"messageArgs": [
"search",
"search"
],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_attribute_allowed",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[2]",
"aria": "/document[1]/main[1]/search[2]"
},
"reasonId": "Fail_invalid_role_attr",
"message": "The ARIA attributes \"aria-checked\" are not valid for the element <search> with ARIA role \"search\"",
"messageArgs": [
"aria-checked",
"search",
"search"
],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_role_redundant",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[3]",
"aria": "/document[1]/main[1]/alert[1]"
},
"reasonId": "pass",
"message": "An explicitly-assigned ARIA role is not redundant with the implicit role of the element",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_semantics_role",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[3]",
"aria": "/document[1]/main[1]/alert[1]"
},
"reasonId": "Fail_1",
"message": "The ARIA role 'alert' is not valid for the element <search>",
"messageArgs": [
"alert",
"search"
],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_role_redundant",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[4]",
"aria": "/document[1]/main[1]/form[1]"
},
"reasonId": "pass",
"message": "An explicitly-assigned ARIA role is not redundant with the implicit role of the element",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_semantics_role",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[4]",
"aria": "/document[1]/main[1]/form[1]"
},
"reasonId": "Pass_0",
"message": "Rule Passed",
"messageArgs": [
"form",
"search"
],
"apiArgs": [],
"category": "Accessibility"
},
{
"ruleId": "aria_attribute_allowed",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/search[4]",
"aria": "/document[1]/main[1]/form[1]"
},
"reasonId": "Pass",
"message": "ARIA attributes are valid for the element and ARIA role",
"messageArgs": [
"aria-atomic",
"search",
"form"
],
"apiArgs": [],
"category": "Accessibility"
}
]
};
</script>
</body>
</html>