Skip to content

Commit a278180

Browse files
committed
Now testing for focusable before reporting on validity of href attribute. Fixes issue #267.
1 parent f3f1001 commit a278180

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Standards/WCAG2AAA/Sniffs/Principle2/Guideline2_4/2_4_1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle2_Guideline2_4_2_4_1 = {
110110
*/
111111
testSameDocFragmentLinks: function(element, top)
112112
{
113-
if (element.hasAttribute('href') === true) {
113+
if (element.hasAttribute('href') === true && HTMLCS.util.isFocusable(element) === true) {
114114
var href = element.getAttribute('href');
115115
href = HTMLCS.util.trim(href);
116116
if ((href.length > 1) && (href.charAt(0) === '#')) {

Tests/WCAG2/2_4_1_Bypass.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>2.4.1 Bypass</title>
5+
<!-- @HTMLCS_Test@
6+
Name: SC 2.4.1 Bypass
7+
Standard: WCAG2AA
8+
Assert: No Error *.G1,G123,G124.NoSuchID on #hidden-anchor
9+
-->
10+
<style type="text/css">
11+
.d-none {
12+
display: none;
13+
}
14+
</style>
15+
</head>
16+
<body>
17+
18+
<a href="#main-content" id="hidden-anchor" class="d-none">
19+
Skip to main content
20+
</a>
21+
22+
</body>
23+
</html>
24+
25+

0 commit comments

Comments
 (0)