From e6dde2b356ed176e91c64388b65284fff39bf123 Mon Sep 17 00:00:00 2001 From: Louis Grasset Date: Sun, 13 Aug 2023 12:00:58 +0200 Subject: [PATCH] feat(a11y): add `alt_text` prop to `Photo` when alt text is available --- src/timeline-tweet-util.ts | 1 + src/timeline-v1.ts | 1 + src/tweets.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/timeline-tweet-util.ts b/src/timeline-tweet-util.ts index 751b8b74..160bb29e 100644 --- a/src/timeline-tweet-util.ts +++ b/src/timeline-tweet-util.ts @@ -22,6 +22,7 @@ export function parseMediaGroups(media: TimelineMediaExtendedRaw[]): { photos.push({ id: m.id_str, url: m.media_url_https, + alt_text: m.ext_alt_text, }); } else if (m.type === 'video') { videos.push(parseVideo(m)); diff --git a/src/timeline-v1.ts b/src/timeline-v1.ts index 07464ac8..b449cdea 100644 --- a/src/timeline-v1.ts +++ b/src/timeline-v1.ts @@ -46,6 +46,7 @@ export interface TimelineMediaExtendedRaw { type?: string; url?: string; video_info?: VideoInfo; + ext_alt_text: string | undefined; } export interface SearchResultRaw { diff --git a/src/tweets.ts b/src/tweets.ts index cac88e73..4e784f8c 100644 --- a/src/tweets.ts +++ b/src/tweets.ts @@ -20,6 +20,7 @@ export interface Mention { export interface Photo { id: string; url: string; + alt_text: string | undefined; } export interface Video {