stefanbohacek/SimpleSharingButtons

Font Awesome icon needs alternative text

aardrian opened this issue · 1 comments

In the output using Font Awesome, there is no alternative text for the icon. A screen reader may speak a glyph name that has no bearing on what is there.

This is a known issue with Font Awesome (#6133), but there is some decent advice at the Font Awesome accessibility page.

In short, take this:

<li><a href="…" target="_blank" title="Tweet"><i class="fa fa-twitter-square fa-2x"></i></a></li>

And make it more like this:

<li><a href="…" target="_blank" title="Tweet"><i class="fa fa-twitter-square fa-2x" aria-hidden="true"></i><span class="sr-only">Tweet</span></a></li>

With the following CSS (class name borrowed, so authors may already have it in place):

ul.share-buttons .sr-only {
  position: absolute;
  clip: rect(1px 1px 1px 1px);
  clip: rect(1px, 1px, 1px, 1px);
  padding: 0;
  border: 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

If that CSS seems verbose, it uses an accessible off-screen technique that is backward compatible.