-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: skip-link rule now checks if a target exists
BREAKING CHANGE: Skip-link rule no longer requires skip lins with a focusable target.
- Loading branch information
1 parent
18263eb
commit f7f9cf3
Showing
13 changed files
with
56 additions
and
124 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 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 |
---|---|---|
@@ -1 +1,5 @@ | ||
return axe.commons.dom.isFocusable(axe.commons.dom.getElementByReference(node, 'href')); | ||
const target = axe.commons.dom.getElementByReference(node, 'href'); | ||
if (target) { | ||
return axe.commons.dom.isVisible(target, true) || undefined; | ||
} | ||
return false; |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"id": "skip-link", | ||
"evaluate": "skip-link.js", | ||
"after": "skip-link-after.js", | ||
"metadata": { | ||
"impact": "moderate", | ||
"messages": { | ||
"pass": "Valid skip link found", | ||
"fail": "No valid skip link found" | ||
"pass": "Skip link target exists", | ||
"incomplete": "Skip link target should become visible on activation", | ||
"fail": "No skip link target" | ||
} | ||
} | ||
} |
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,2 @@ | ||
const href = node.getAttribute('href'); | ||
return (href[0] === '#' && href.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
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 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,14 @@ | ||
|
||
<a href="foo#bar" id="ignore1">link</a> | ||
<a href="#" id="ignore2">link</a> | ||
|
||
<div id="pass1-tgt"></div> | ||
<a href="#pass1-tgt" id="pass1">Link</a> | ||
|
||
<a name="pass2-tgt"></a> | ||
<a href="#pass2-tgt" id="pass2">Link</a> | ||
|
||
<div id="canttell1-tgt" style="display:none"></div> | ||
<a href="#canttell1-tgt" id="canttell1">Link</a> | ||
|
||
<a href="#fail1-tgt" id="fail1">bad link 1</a> |
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,6 @@ | ||
{ | ||
"rule": "skip-link", | ||
"violations": [["#fail1"]], | ||
"incomplete": [["#canttell1"]], | ||
"passes": [["#pass1"], ["#pass2"]] | ||
} |