Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/Library/Thumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import tw from '~/util/tailwind';

type Props = {
url: string;
name: string;
};

const GITHUB_PREVIEW_MIN_WIDTH = 640;

function Thumbnail({ url }: Props) {
function Thumbnail({ url, name }: Props) {
const { width, height } = useWindowDimensions();

const [isLoaded, setLoaded] = useState(false);
Expand Down Expand Up @@ -56,7 +57,7 @@ function Thumbnail({ url }: Props) {
<img
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.

style={{
...tw`rounded`,
maxWidth: maxPreviewImageWidth,
Expand Down
2 changes: 1 addition & 1 deletion components/Library/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function Library({
{!skipMetadata && Platform.OS === 'web' && library.images && library.images.length > 0 && (
<View style={tw`mt-2 flex-row flex-wrap items-center gap-x-0.5`}>
{library.images.map(image => (
<Thumbnail key={image} url={image} />
<Thumbnail key={image} url={image} name={libName} />
))}
</View>
)}
Expand Down