I'm trying to find the best way to improve a11y for links that are built just using background images inside a span (the old school massive icons spritesheets approach). They're part of a large website and changing the whole icon system isn't a realistic scenario right now.
What we basically have are these two different links all around;
First one being the problem:
<a href="#" aria-label="Functionality Description">
<span class="icon-functionality"></span>
</a>
The other link style has text in it, so should be fine.
<a href="#" aria-label="Functionality Description">
<span class="icon-text">Functionality</span>
<span class="icon-functionality"></span>
</a>
Trying to find out what should we do in the first case, I found a solution that I'm not sure about; giving the span containing the background the role="img" and an empty alt attribute.
This way, the anchor has an image in it, and by using the empty alt attribute, the screen reader would understand it's a decorative picture. In this case, the reader has the aria-label associated to the anchor to 'understand' the funcitonality.
<a href="#" aria-label="Functionality Description">
<span class="icon-functionality" role="img" alt></span>
</a>
Although I know it's not ideal and in a long term basis we may want to change the whole icon system, would this be enough to provide a decent a11y? What do you think?
All recommendations are welcome. Massive thanks in advance!
Edit to add a screenshot of the Siteimprove error given:
