set descriptive alt text on library screenshot thumbnails#2432
Open
azizbecha wants to merge 1 commit intoreact-native-community:mainfrom
Open
set descriptive alt text on library screenshot thumbnails#2432azizbecha wants to merge 1 commit intoreact-native-community:mainfrom
azizbecha wants to merge 1 commit intoreact-native-community:mainfrom
Conversation
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.
Simek
reviewed
May 3, 2026
| src={url} | ||
| onLoad={() => setLoaded(true)} | ||
| alt="" | ||
| alt={`${name} screenshot`} |
Member
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
components/Library/Thumbnail.tsxrendered the screenshot<img>withalt="", 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) fromLibrary/index.tsxintoThumbnailand uses it as the alt text (e.g."react-native-foo screenshot").