feat: image error placeholder + scroll-to-top on navigation
Image bubbles previously used the raw filename as alt text, so a failed asset load exposed the file name in the broken-image box. Add a reusable BubbleImage that renders an empty alt and falls back to a neutral placeholder (ImageOff icon) on error; use it in the album, image, and image-with-text bubbles, and drop the filename from their aria-labels. Also add a global ScrollToTop that resets the window on route change so desktop navigation matches mobile (e.g. clicking a category card no longer lands at the bottom of the new page). Hash navigations are skipped so #post-<id> deep-link scrolling still works. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Post } from "../../../types/post";
|
||||
import { AttachmentDownloadPill } from "../AttachmentDownloadPill";
|
||||
import { BubbleImage } from "../BubbleImage";
|
||||
import { useLightbox } from "../overlays/ImageLightbox";
|
||||
|
||||
export function ImageBubble({ post }: { post: Post }) {
|
||||
@@ -12,11 +13,10 @@ export function ImageBubble({ post }: { post: Post }) {
|
||||
type="button"
|
||||
onClick={() => openLightbox([att], 0, undefined, post.id)}
|
||||
className="block h-full w-full"
|
||||
aria-label={att.filename}
|
||||
aria-label="View image"
|
||||
>
|
||||
<img
|
||||
<BubbleImage
|
||||
src={att.url}
|
||||
alt={att.filename}
|
||||
loading="lazy"
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user