vercel / react-tweet

Embed tweets in your React application.
https://react-tweet.vercel.app
MIT License
1.52k stars 83 forks source link

Use provided image `alt` text if user added one #35

Closed tywayne closed 1 year ago

tywayne commented 1 year ago

Twitter allows users to add alt text to their images when adding them to a tweet. The API also exposes this to us for photo media types. We should use that user-provided alt test as descriptive text on the img if provided.

Additionally, since the <Image /> is the only descendant of the containing <a>, an aria-label on the anchor is duplicative. A screen reader will use the img alt tag as the anchor text. Removing the aria-label attribute will keep a screen reader from reading out the same text twice in row.

Example tweet where alt text is provided