P
P
Polina Titova2021-10-06 19:21:22
HTML
Polina Titova, 2021-10-06 19:21:22

How to fix redundant alt attribute?

When checking the program for eslint errors, the following message was displayed:

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

function ItemList(): JSX.Element {
  const href = '#';
  return (
    <div className="cities__image-wrapper place-card__image-wrapper">
      <a href={href}>
        <img className="place-card__image" src="img/apartment-01.jpg" width="260" height="200" alt="Place image" />
      </a>
    </div>
  );
}

export default ItemList;

What is it connected with and how can it be corrected?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-10-06
@poly-titova

Place image -> Place
Well, or chop off this stupid eslint rule.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question