Files
pad/web/src/lib/utils
xarmian 4c2c4d1e1d feat(comments): thumbnail comment images + click-to-expand lightbox (IDEA-1660) (#664)
* feat(comments): thumbnail comment images + click-to-expand lightbox (IDEA-1660)

Tier 1 + Tier 2 of the IDEA-1650 follow-up.

Tier 1 — thumbnails:
- Thread an image `variant` through the markdown render pipeline
  (renderMarkdown → AttachmentRenderContext → resolveAttachmentImage →
  renderAttachmentImage), defaulting to thumb-md. Comment + reply bodies
  pass thumb-sm (256px) so pasted screenshots fetch the small variant.
- CSS caps inline attachment images to a 280×180 box with cursor:zoom-in.

Tier 2 — lightbox:
- New reusable Lightbox.svelte (common/) — full-resolution overlay,
  Esc/backdrop close, ←/→ paging, image counter. Loads the original
  (un-variant) blob for full detail.
- ItemTimeline attaches a delegated click handler (via a use: action, so
  no a11y lint on the static container) that opens the lightbox on any
  img[data-attachment-id], collecting sibling images in the same
  comment/reply body for paging.

No backend changes. Tier 3 (dims-via-headers, multi-image grid,
loading=lazy) intentionally deferred.

* fix(comments): keyboard-activatable comment image thumbnails per Codex review (round 1)

Thumbnails come from sanitized {@html}, so they can't be wrapped in a
<button> at render time. Instead make each img[data-attachment-id] a
focusable role=button with an aria-label imperatively (re-applied on
entries change, covering SSE-added comments), and add a delegated
keydown (Enter/Space) alongside the existing click so keyboard users
can open the lightbox.

* fix(comments): re-run thumbnail focusability pass when attachment metadata resolves per Codex review (round 2)

An attachment renders as <img> only after its HEAD-probe metadata
resolves (before that it's a 'missing' placeholder span). The
focusability pass depended only on entries, so it missed images that
appeared on metadata resolution. Add attMeta as a dependency.
2026-05-30 11:38:42 -04:00
..
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00