Need to add aria-hidden="true" to all 7 anchor links in order to prevent failing Level A for "Empty link".. could anyone help write a patch and commit?
switch (mt_rand(0, 6)) {
case 0:
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '"><!-- ' . $word . ' --></a></div>';
case 1:
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '" style="display: none;">' . $word . '</a></div>';
case 2:
return '<div aria-hidden="true" style="display: none;"><a rel="nofollow" href="' . $link . '">' . $word . '</a></div>';
case 3:
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '"></a></div>';
case 4:
return '<!-- <a aria-hidden="true" href="' . $link . '">' . $word . '</a> -->';
case 5:
return '<div style="position: absolute; top: -250px; left: -250px;"><a aria-hidden="true" rel="nofollow" href="' . $link . '">' . $word . '</a></div>';
case 6:
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '"><span style="display: none;">' . $word . '</span></a></div>';
// In some browsers case 7 renders a visible link that could be clicked by users
// case 7:
// return '<div style="height: 0px; width: 0px;"><a aria-hidden="true" rel="nofollow" href="'. $link .'">'. $word .'</a></div>';
}
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | adding-aria-to-anchor-links-2982685-2.patch | 2.15 KB | dat deaf drupaler |
Comments
Comment #2
dat deaf drupaler commentedWoot, my first patch!!
Comment #3
dat deaf drupaler commentedResubmitting proper patch file...
Comment #4
dat deaf drupaler commentedComment #5
bryrock commentedHi
Thanks for your patch. My head's sorta in D8 version testing right now so I haven't yet tested this for 7.x, but I borrowed the code in your patch to update 8.x.
If you would open a new issue for this for 8 ("D8 WCAG accessibility" for example), then I can credit you when I make that commit, and invite the community to review this 7.x patch as well.
Comment #6
dat deaf drupaler commentedThanks @bryrock! I've created an issue here - https://www.drupal.org/project/httpbl/issues/2991993
Comment #7
andrewmacpherson commentedcleaning up bad tags, these were missing the comma separator
Comment #8
andrewmacpherson commentedAdding
aria-hidden="true"here is misguided. It won't solve all the accessibility problems here.Notes:
aria-hidden="true"will hide the link from assistive technology, but these are still operable links for keyboard users who are not using assistive technology, who can accidentally trigger it.aria-hidden="true"only hides if from assistive tech users, not all users. CSSdisplay:noneon either the will hide it from every one who has CSS turned on. Some users will be able to accidentally activate this link, notably keyboard users without assitive technology and with CSS off. (This is a real group of users!)aria-hidden="true"here.