What’s best for SEO isn’t always best for accessibility

I’ve written about how SEO has made the web more accessible, but this week I was reminded that what’s best for SEO isn’t always what’s best for accessibility.

Earlier this week, I noticed that the Gravatar image that WordPress inserts into the short bio section of Coywolf News articles had a blank alt attribute. I wanted to fix it by having WordPress automatically output the author’s name for the alt value. After doing some digging online, I found a good solution and shared it on Twitter.

Tweet about WordPress code that inserts the authors name for the ALT value for Gravatar images.

The tip was well received, but Joost de Valk, founder of Yoast, was quick to point out that the code would also output the author’s name for everyone that left comments on the page. It wasn’t a big deal to me because I quit using WordPress comments on my sites several years ago, but it is still good to know for those who still use the native commenting system.

The next day Chris Johnson, Head of Technical at Bamboo Nine, pointed out that the best choice might be to leave the alt value blank for accessibility. He shared a WebAIM article on Alternative Text and Accessibility. In the section, Context is Everything, an example closely matched the layout of my short bio.

Example of a bio that has the person's image next to their name in plain text.

The example considered if an image of a person should have a value for the alt attribute if the person’s name in the photo was adjacent to it. It concluded that the alt value should be blank because it was redundant to the adjacent name.

That revelation led me to remove the code from my themes’ functions.php files. It also got me thinking about the countless other ways our sites make it difficult for people to use screen readers to navigate and interact with our sites.

An excellent place to start is with accessibility evaluation tools, like WebAIM’s Web Accessibility Evaluation Tool (WAVE). However, the best way to learn how to improve your site for accessibility is to hire a service that uses people with disabilities to test your site.