I have a React application and I'm getting the following error:
Redundant alt attribute. Screen-readers already announce 'img' tags as an image. You don’t need to use the words 'image', 'photo,' or 'picture' (or any specified custom words) in the alt prop jsx-a11y/img-redundant-alt
I'm using the alt
tag on my images and including these keywords in my alt text but the error still persists. What should I do now?
It looks like you're referring to an error generated by react-a11y and specifically the img-redundant-alt rule.
The img-redundant-alt
rule has the following default options: ["image","picture","photo"]
This means one of your alt
descriptions contains one of these words. The logic behind the error is that describing an image as image is not useful to readers.
You can resolve by removing any instances of the words "image", "picture", or "photo" from your alt
tags or by modifying the default options for this rule if you wish to ignore them.