Skip to content

set descriptive alt text on library screenshot thumbnails#2432

Open
azizbecha wants to merge 1 commit intoreact-native-community:mainfrom
azizbecha:fix/thumbnail-alt-text
Open

set descriptive alt text on library screenshot thumbnails#2432
azizbecha wants to merge 1 commit intoreact-native-community:mainfrom
azizbecha:fix/thumbnail-alt-text

Conversation

@azizbecha
Copy link
Copy Markdown
Contributor

@azizbecha azizbecha commented May 2, 2026

Summary

components/Library/Thumbnail.tsx rendered the screenshot <img> with alt="", which signals to assistive technology that the image is purely decorative. These are actual package screenshots, so the empty alt hides meaningful content from screen readers.

This threads the library name (npmPkg ?? github.fullName) from Library/index.tsx into Thumbnail and uses it as the alt text (e.g. "react-native-foo screenshot").

The screenshot preview img used alt="", which marks it as decorative even
though it is a real package screenshot. Pass the library name down from
Library and use it as the alt text so screen readers announce the image.
src={url}
onLoad={() => setLoaded(true)}
alt=""
alt={`${name} screenshot`}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general from a11y/SEO perspective image descriptions should be unique/distinctive. We cannot set proper descriptions since we does not have clue what the screenshot includes, but let's at least use the index in the sentence to number the images.

Also, let's pass alt as a prop, and avoid using package specifc name prop, so component would be a bit more generalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants