-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(has-no-more-than-one-main): Rename check to page-no-duplicate for…
… better reuse
- Loading branch information
1 parent
ced7f2f
commit e75324b
Showing
33 changed files
with
201 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"id": "page-no-duplicate-banner", | ||
"evaluate": "page-no-duplicate.js", | ||
"options": { | ||
"selector": "header:not([role]), [role=banner]", | ||
"nativeScopeFilter": "article, aside, main, nav, section" | ||
}, | ||
"metadata": { | ||
"impact": "moderate", | ||
"messages": { | ||
"pass": "Document has no more than one banner landmark", | ||
"fail": "Document has more than one banner landmark" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"id": "page-no-duplicate-contentinfo", | ||
"evaluate": "page-no-duplicate.js", | ||
"options": { | ||
"selector": "footer:not([role]), [role=contentinfo]", | ||
"nativeScopeFilter": "article, aside, main, nav, section" | ||
}, | ||
"metadata": { | ||
"impact": "moderate", | ||
"messages": { | ||
"pass": "Document has no more than one contentinfo landmark", | ||
"fail": "Document has more than one contentinfo landmark" | ||
} | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
...s/keyboard/has-no-more-than-one-main.json → ...ecks/keyboard/page-no-duplicate-main.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
if (!options || !options.selector || typeof options.selector !== 'string') { | ||
throw new TypeError('visible-in-page requires options.selector to be a string'); | ||
} | ||
|
||
let elms = axe.utils.querySelectorAll(virtualNode, options.selector); | ||
|
||
// Filter elements that, within certain contexts, don't map their role. | ||
// e.g. a <footer> inside a <main> is not a banner, but in the <body> context it is | ||
if (typeof options.nativeScopeFilter === 'string') { | ||
elms = elms.filter(elm => { | ||
return (elm.actualNode.hasAttribute('role') || | ||
!axe.commons.dom.findUpVirtual(elm, options.nativeScopeFilter)); | ||
}); | ||
} | ||
|
||
this.relatedNodes(elms.map(elm => elm.actualNode)); | ||
|
||
return elms.length <= 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"id": "landmark-no-duplicate-banner", | ||
"selector": "html", | ||
"tags": [ | ||
"best-practice" | ||
], | ||
"metadata": { | ||
"description": "Ensures the document has no more than one banner landmark", | ||
"help": "Document contain at most one banner landmark" | ||
}, | ||
"all": [], | ||
"any": [ | ||
"page-no-duplicate-banner" | ||
], | ||
"none": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"id": "landmark-no-duplicate-contentinfo", | ||
"selector": "html", | ||
"tags": [ | ||
"best-practice" | ||
], | ||
"metadata": { | ||
"description": "Ensures the document has no more than one contentinfo landmark", | ||
"help": "Document contain at most one contentinfo landmark" | ||
}, | ||
"all": [], | ||
"any": [ | ||
"page-no-duplicate-contentinfo" | ||
], | ||
"none": [] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.