Skip to content

Commit b405af1

Browse files
committed
fix(main-is-top-level): Rename check to landmark-is-top-level for greater reuse
BREAKING CHANGE: The check main-is-top-level is no longer available
1 parent 7b66768 commit b405af1

20 files changed

+110
-283
lines changed

doc/rule-descriptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
| input-image-alt | Ensures <input type="image"> elements have alternate text | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a | true |
3535
| label-title-only | Ensures that every form element is not solely labeled using the title or aria-describedby attributes | cat.forms, best-practice | true |
3636
| label | Ensures every form element has a label | cat.forms, wcag2a, wcag332, wcag131, section508, section508.22.n | true |
37-
| landmark-banner-is-top-level | A banner landmark identifies site-oriented content at the beginning of each page within a website | best-practice | true |
38-
| landmark-contentinfo-is-top-level | A contentinfo landmark is a way to identify common information at the bottom of each page within a website | best-practice | true |
37+
| landmark-banner-is-top-level | The banner landmark should not be contained in another landmark | best-practice | true |
38+
| landmark-contentinfo-is-top-level | The contentinfo landmark should not be contained in another landmark | best-practice | true |
3939
| landmark-main-is-top-level | The main landmark should not be contained in another landmark | best-practice | true |
4040
| landmark-no-duplicate-banner | Ensures the document has no more than one banner landmark | best-practice | true |
4141
| landmark-no-duplicate-contentinfo | Ensures the document has no more than one contentinfo landmark | best-practice | true |

lib/checks/keyboard/banner-is-top-level.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/checks/keyboard/banner-is-top-level.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/checks/keyboard/contentinfo-is-top-level.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/checks/keyboard/contentinfo-is-top-level.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/checks/keyboard/main-is-top-level.js renamed to lib/checks/keyboard/landmark-is-top-level.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
var landmarks = axe.commons.aria.getRolesByType('landmark');
22
var parent = axe.commons.dom.getComposedParent(node);
3+
4+
this.data({
5+
role: node.getAttribute('role') || axe.commons.aria.implicitRole(node)
6+
});
7+
38
while (parent){
49
var role = parent.getAttribute('role');
510
if (!role && (parent.tagName.toLowerCase() !== 'form')){
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"id": "landmark-is-top-level",
3+
"evaluate": "landmark-is-top-level.js",
4+
"metadata": {
5+
"impact": "moderate",
6+
"messages": {
7+
"pass": "The {{=it.data.role }} landmark is at the top level.",
8+
"fail": "The {{=it.data.role }} landmark is contained in another landmark."
9+
}
10+
}
11+
}

lib/checks/keyboard/main-is-top-level.json

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"id": "landmark-banner-is-top-level",
3-
"selector": "[role=banner], header",
3+
"selector": "header:not([role]), [role=banner]",
4+
"matches": "landmark-has-body-context.js",
45
"tags": [
56
"best-practice"
67
],
78
"metadata": {
8-
"description": "A banner landmark identifies site-oriented content at the beginning of each page within a website",
9+
"description": "The banner landmark should not be contained in another landmark",
910
"help": "Banner landmark must be at top level"
1011
},
1112
"all": [],
1213
"any": [
13-
"banner-is-top-level"
14+
"landmark-is-top-level"
1415
],
1516
"none": []
1617
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"id": "landmark-contentinfo-is-top-level",
3-
"selector": "[role=contentinfo], footer",
3+
"selector": "footer:not([role]), [role=contentinfo]",
4+
"matches": "landmark-has-body-context.js",
45
"tags": [
56
"best-practice"
67
],
78
"metadata": {
8-
"description": "A contentinfo landmark is a way to identify common information at the bottom of each page within a website",
9+
"description": "The contentinfo landmark should not be contained in another landmark",
910
"help": "Contentinfo landmark must be at top level"
1011
},
1112
"all": [],
1213
"any": [
13-
"contentinfo-is-top-level"
14+
"landmark-is-top-level"
1415
],
1516
"none": []
1617
}

0 commit comments

Comments
 (0)