Skip to content

Commit

Permalink
Additional fix for #160 allowing hyperlinks with labels to be conside…
Browse files Browse the repository at this point in the history
…red as having valid content.
  • Loading branch information
ironikart committed Jun 19, 2017
1 parent 1588f47 commit 828939e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Standards/WCAG2AAA/Sniffs/Principle4/Guideline4_1/4_1_2.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle4_Guideline4_1_4_1_2 = {
}//end if
} else {
if (nameFound === false) {
// Href provided, but no content or title.
// Href provided, but no content, title or valid aria label.
// We only fire this message when there are no images in the content.
// A link around an image with no alt text is already covered in SC
// 1.1.1 (test H30).
if (element.querySelectorAll('img').length === 0) {
if (element.querySelectorAll('img').length === 0
&& HTMLCS.util.hasValidAriaLabel(element) === false
) {
errors.noContent.push(element);
}
}//end if
Expand Down
3 changes: 3 additions & 0 deletions Tests/WCAG2/4_1_2_Aria_Labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Assert: Error *.H53.ARIA6 on #objectNoLabel
Assert: No Error *.H53.ARIA6 on #objectLabelledBy
Assert: No Error *.H53.ARIA6 on #objectLabel
Assert: No Error *.H91.A.NoContent on #hyperlinkLabel
-->
</head>
<body>
Expand Down Expand Up @@ -42,6 +43,8 @@

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

<a id="hyperlinkLabel" href="http://www.squiz.net" aria-label="Label as valid content"></a>

</form>
</body>
</html>

0 comments on commit 828939e

Please sign in to comment.