Skip to content

Commit 828939e

Browse files
committed
Additional fix for #160 allowing hyperlinks with labels to be considered as having valid content.
1 parent 1588f47 commit 828939e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Standards/WCAG2AAA/Sniffs/Principle4/Guideline4_1/4_1_2.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,13 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_2 = {
136136
}//end if
137137
} else {
138138
if (nameFound === false) {
139-
// Href provided, but no content or title.
139+
// Href provided, but no content, title or valid aria label.
140140
// We only fire this message when there are no images in the content.
141141
// A link around an image with no alt text is already covered in SC
142142
// 1.1.1 (test H30).
143-
if (element.querySelectorAll('img').length === 0) {
143+
if (element.querySelectorAll('img').length === 0
144+
&& HTMLCS.util.hasValidAriaLabel(element) === false
145+
) {
144146
errors.noContent.push(element);
145147
}
146148
}//end if

Tests/WCAG2/4_1_2_Aria_Labels.html

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Assert: Error *.H53.ARIA6 on #objectNoLabel
1313
Assert: No Error *.H53.ARIA6 on #objectLabelledBy
1414
Assert: No Error *.H53.ARIA6 on #objectLabel
15+
Assert: No Error *.H91.A.NoContent on #hyperlinkLabel
1516
-->
1617
</head>
1718
<body>
@@ -42,6 +43,8 @@
4243

4344
<object id="objectLabel" data="x.jpg" aria-label="monkey"></object>
4445

46+
<a id="hyperlinkLabel" href="http://www.squiz.net" aria-label="Label as valid content"></a>
47+
4548
</form>
4649
</body>
4750
</html>

0 commit comments

Comments
 (0)