From 0ecb25a8d45b7768bada974a9d6a99b17cf8bf49 Mon Sep 17 00:00:00 2001 From: maria Date: Sat, 10 Oct 2026 21:47:09 -0300 Subject: [PATCH] fix(web): media preview centers its content and pins the close button (#17951) --- .../components/chat/ExpandedImageDialog.tsx | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/apps/web/src/components/chat/ExpandedImageDialog.tsx b/apps/web/src/components/chat/ExpandedImageDialog.tsx index 0e641327a1328cd0c29370ecba5d48d03bd74e5f..98c73d47c97a05be84c6dbe3bf9af9e5a20b4a53 100644 --- a/apps/web/src/components/chat/ExpandedImageDialog.tsx +++ b/apps/web/src/components/chat/ExpandedImageDialog.tsx @@ -180,7 +180,7 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({ variant="media" showCloseButton={false} bottomStickOnMobile={false} - className="row-start-1 max-h-[92vh] w-[92vw] max-w-[92vw] items-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]" + className="row-start-1 h-full max-h-[92vh] w-[92vw] max-w-[92vw] items-center justify-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]" onKeyDown={onKeyDown} initialFocus={closeButtonRef} finalFocus={() => returnFocusTarget} @@ -189,12 +189,24 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({ }} > Expanded {mediaLabel} preview + {/* The stage keeps a fixed size, so the close button stays put whatever the media or caption. */} + {preview.images.length > 1 && ( )} -
- +
{item.type === "video" ? ( ) : showingAccessibilityDetails ? ( @@ -241,7 +242,7 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({ onError={() => setFailedImageSrc(item.src)} /> )} -
+
{item.name} {preview.images.length > 1 ? ` (${index + 1}/${preview.images.length})` : ""} @@ -280,7 +281,7 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({ type="button" size="icon" variant="media-navigation" - className="right-0 top-auto -bottom-12 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2" + className="right-0 top-auto bottom-0 translate-y-0 sm:top-1/2 sm:bottom-auto sm:-translate-y-1/2" aria-label="Next media" onClick={() => navigateImage(1)} > -- 2.54.0