1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-03-05 13:20:20 -05:00

Add alt text for series images

Closes #8332
This commit is contained in:
Mark McDowall
2026-01-06 18:43:26 -08:00
parent e20b4c4f5d
commit 276e67b5fa
9 changed files with 43 additions and 1 deletions

View File

@@ -136,6 +136,7 @@ function AddNewSeriesModalContent({
className={styles.poster}
images={images}
size={250}
title={title}
/>
</div>
)}

View File

@@ -74,6 +74,7 @@ function AddNewSeriesSearchResult({ series }: AddNewSeriesSearchResultProps) {
size={250}
overflow={true}
lazy={false}
title={title}
/>
)}

View File

@@ -45,6 +45,7 @@ function SeriesSearchResult(props: SeriesSearchResultProps) {
size={250}
lazy={false}
overflow={true}
title={title}
/>
<div className={styles.titles}>

View File

@@ -526,6 +526,7 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
images={images}
size={500}
lazy={false}
title={title}
/>
<div className={styles.info}>

View File

@@ -171,6 +171,7 @@ function SeriesIndexOverview(props: SeriesIndexOverviewProps) {
size={250}
lazy={false}
overflow={true}
title={title}
/>
</Link>
</div>

View File

@@ -183,6 +183,7 @@ function SeriesIndexPoster(props: SeriesIndexPosterProps) {
size={250}
lazy={false}
overflow={true}
title={title}
onError={onPosterLoadError}
onLoad={onPosterLoad}
/>

View File

@@ -198,6 +198,7 @@ function SeriesIndexRow(props: SeriesIndexRowProps) {
images={images}
lazy={false}
overflow={true}
title={title}
onError={onBannerLoadError}
onLoad={onBannerLoad}
/>

View File

@@ -1,5 +1,12 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import LazyLoad from 'react-lazyload';
import translate from 'Utilities/String/translate';
import { CoverType, Image } from './Series';
function findImage(images: Image[], coverType: CoverType) {
@@ -23,6 +30,7 @@ export interface SeriesImageProps {
size?: number;
lazy?: boolean;
overflow?: boolean;
title: string;
onError?: () => void;
onLoad?: () => void;
}
@@ -38,6 +46,7 @@ function SeriesImage({
size = 250,
lazy = true,
overflow = false,
title,
onError,
onLoad,
}: SeriesImageProps) {
@@ -46,6 +55,26 @@ function SeriesImage({
const [isLoaded, setIsLoaded] = useState(true);
const image = useRef<Image | null>(null);
const alt = useMemo(() => {
let type = translate('ImagePoster');
switch (coverType) {
case 'banner':
type = translate('Banner');
break;
case 'fanart':
type = translate('ImageFanart');
break;
case 'season':
type = translate('ImageSeason');
break;
default:
break;
}
return `${title} ${type}`;
}, [title, coverType]);
const handleLoad = useCallback(() => {
setHasError(false);
setIsLoaded(true);
@@ -103,6 +132,7 @@ function SeriesImage({
}
>
<img
alt={alt}
className={className}
style={style}
src={url}
@@ -116,6 +146,7 @@ function SeriesImage({
return (
<img
alt={alt}
className={className}
style={style}
src={isLoaded ? url : placeholder}

View File

@@ -842,7 +842,11 @@
"IgnoreDownloadsHint": "Stops {appName} from processing these downloads further",
"Ignored": "Ignored",
"IgnoredAddresses": "Ignored Addresses",
"ImageBanner": "banner",
"ImageFanart": "fanart",
"ImagePoster": "poster",
"Images": "Images",
"ImageSeason": "season",
"ImdbId": "IMDb ID",
"Implementation": "Implementation",
"Import": "Import",