Skip to content

Commit 58f950a

Browse files
Add default images alt="" when not set
1 parent a4b7eb0 commit 58f950a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/content-presentation/images/Images.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ interface ImageProps extends ComponentPropsWithoutRef<'img'> {
55
caption?: string;
66
}
77

8-
const ImagesComponent: FC<ImageProps> = ({ className, caption, ...rest }) => (
8+
const ImagesComponent: FC<ImageProps> = ({ alt = '', className, caption, ...rest }) => (
99
<figure className="nhsuk-image">
10-
{/* eslint-disable-next-line jsx-a11y/alt-text */}
11-
<img className={classNames('nhsuk-image__img', className)} {...rest} />
10+
<img className={classNames('nhsuk-image__img', className)} alt={alt} {...rest} />
1211
{caption ? <figcaption className="nhsuk-image__caption">{caption}</figcaption> : null}
1312
</figure>
1413
);

src/components/content-presentation/images/__tests__/__snapshots__/Images.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ exports[`Images matches snapshot: Images 1`] = `
66
class="nhsuk-image"
77
>
88
<img
9+
alt=""
910
class="nhsuk-image__img"
1011
/>
1112
</figure>

0 commit comments

Comments
 (0)