Which tags should wrap a social media icon in respect to accessibility? I have this div, containing social media icons:
<div class="social-media-container" role="region">
<div>
<ion-icon name="logo-facebook"><a href="#"></a></ion-icon>
</div>
<div>
<ion-icon name="logo-twitter"><a href="#"></a></ion-icon>
</div>
<div>
<ion-icon name="logo-instagram"><a href="#"></a></ion-icon>
</div>
</div>
Wrapped in a div with an aria-ole are three social media icons. Which tag should I use for them in respect to accessibility?
As far as I know, there isn't a specific tag which should be used to wrap icons. However, you can do some things to make your icons accessible, as from Font Awesome docs:
If your icons have semantic meaning, you’ll need to manually add a few things so that your icon is appropriately accessible:
- aria-hidden="true" attribute.
- Provide a text alternative inside a (or similar) element. Also include appropriate CSS to visually hide the element while keeping it accessible to assisitive technologies.
- title attribute on the icon to provide a tooltip for sighted mouse users.
According to that, your HTML would be this way:
<div class="social-media-container" role="region">
<div>
<a href="#">
<ion-icon name="logo-facebook" aria-hidden="true" title="Visit our Facebook webpage"></ion-icon>
<span class="sr-only">Visit our Facebook webpage</span>
</a>
</div>
<div>
<a href="#">
<ion-icon name="logo-twitter" aria-hidden="true" title="Visit our Twitter webpage"></ion-icon>
<span class="sr-only">Visit our Twitter webpage</span>
</a>
</div>
<div>
<a href="#">
<ion-icon name="logo-instagram" aria-hidden="true" title="Visit our Instagram webpage"></ion-icon>
<span class="sr-only">Visit our Instagram webpage</span>
</a>
</div>
</div>