fix(media): restore height for portrait images, keep width centering fix

h-fit (from the previous fix) disabled the flex cross-axis stretch that
h-auto triggers. That stretch is what gave the image wrapper a definite
height in the first place — without it, the image's max-h-full (a
percentage) had no definite reference to resolve against, so browsers
ignored it and the image rendered at its full natural height, getting
clipped at the bottom of the dialog.

Width and height turned out to need opposite fixes: w-fit for width
(explicit shrink-to-fit avoids the flex-item main-axis stretch that
caused the left-alignment bug), h-auto for height (keeps the cross-axis
stretch that max-h-full depends on).
This commit is contained in:
admin committed 2026-08-14 15:07:40 +02:00
1 parent 98037d434e
commit 9efc207710
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -265,7 +265,7 @@ export function PostDetailDialog({ post, open, onClose, onDeleted }: PostDetailD
blurhash={img.blurhash}
alt={currentCaption ?? `${pet.name}'s post`}
className="block max-h-full max-w-full object-contain"
wrapperClassName="relative block h-fit w-fit"
wrapperClassName="relative block h-auto w-fit"
/>
</CarouselItem>
))}
@@ -294,7 +294,7 @@ export function PostDetailDialog({ post, open, onClose, onDeleted }: PostDetailD
blurhash={images[0].blurhash}
alt={currentCaption ?? `${pet.name}'s post`}
className="block max-h-full max-w-full object-contain"
wrapperClassName="relative block h-fit w-fit"
wrapperClassName="relative block h-auto w-fit"
/>
<AiDisclosureBadge value={post.aiDisclosure} className="h-8" />
</div>
+1 -1
View File
@@ -168,7 +168,7 @@ export function StoryViewer({
blurhash={currentStory.blurhash}
alt={t("storyAriaLabel", { petName })}
className="block max-h-screen max-w-full object-contain"
wrapperClassName="relative block h-fit w-fit"
wrapperClassName="relative block h-auto w-fit"
/>
<AiDisclosureBadge
value={currentStory.aiDisclosure}