From 23bafcfb29c5065497894c2e48b37071977c72f5 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 8 Apr 2026 10:42:09 -0500 Subject: [PATCH] Use AutoSizedImage for screen reader view --- src/components/images/Gallery/index.tsx | 68 ++++++++----------------- 1 file changed, 20 insertions(+), 48 deletions(-) diff --git a/src/components/images/Gallery/index.tsx b/src/components/images/Gallery/index.tsx index 01c572a42f..39cb0a6a44 100644 --- a/src/components/images/Gallery/index.tsx +++ b/src/components/images/Gallery/index.tsx @@ -12,6 +12,7 @@ import {type Dimensions} from '#/lib/media/types' import {useA11y} from '#/state/a11y' import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge' import {atoms as a, useTheme} from '#/alf' +import {AutoSizedImage} from '#/components/images/AutoSizedImage' import {MediaInsetBorder} from '#/components/MediaInsetBorder' import {PostEmbedViewContext} from '#/components/Post/Embed/types' import {Text} from '#/components/Typography' @@ -96,55 +97,26 @@ export function Gallery({ if (screenReaderEnabled) { return ( - + {images.map((image, index) => ( - - - onPress( - index, - containerRefs.slice(0, images.length), - thumbDimsRef.current.slice(), - ) - : undefined - } - onPressIn={onPressIn ? () => onPressIn(index) : undefined} - accessibilityRole="button" - accessibilityLabel={ - image.alt || l`Image ${index + 1} of ${images.length}` - } - accessibilityHint={l`Opens full image`} - style={[a.flex_1]}> - { - thumbDimsRef.current[index] = { - width: e.source.width, - height: e.source.height, - } - }} - loading={index === 0 ? 'eager' : 'lazy'} - /> - - - + + onPress?.(index, [containerRef], [dims]) + } + onPressIn={() => onPressIn?.(index)} + hideBadge={ + viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia + } + /> ))} )