feat(ui): image lightbox - click an inline image to view it enlarged (LC-262) #309
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-262-image-lightbox"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Inline image attachments now open in an in-app lightbox (LC-262) instead of navigating to the raw file in a new tab. Click an image to view it enlarged over a dark backdrop with the filename as a caption; ArrowLeft/ArrowRight page through every image on the page (wrapping), and Esc / backdrop click / the close button dismiss it.
How
partials/attachment.html: the image anchor gains adata-lc-lightboxmarker but keeps itshref+target="_blank", so with JS disabled the click still opens the raw image in a new tab (progressive enhancement - nothing hidden from no-JS clients).templates/lightbox_modal.html: a singleton overlay in the persistent shell, mirroring the shortcuts/switcher modal lifecycle (__lcDialogTrapfocus trap, opener focus restore). A delegatedclickona[data-lc-lightbox]snapshots all such anchors on the page, opens at the clicked index, and shows the full-sizehref. Plain left-click only - modified clicks (open-in-tab) keep native behavior. Covers images rendered after load (live arrivals, thread panel, edits) for free via delegation.main.css:.lc-lightbox-imgconstrains the image to the viewport (90vw/85vh,object-fit: contain); sizing lives here rather than as Tailwind arbitrary values so it is reliable without a CSS rebuild.No new route, DB, or env var. Not operator-visible. No LC-77 fixture impact (those carry no attachments).
Tests
routes_drafts::image_attachment_ships_lightbox_markupseeds an image attachment (insert_upload+link_upload_to_message) and asserts the anchor is lightbox-enabled and the page ships the modal.just testandjust test-saaspass.QA note
The viewer is JS-driven, so worth a quick manual pass before merge: click an image (opens enlarged with caption); with 2+ images, Arrow keys + prev/next page through and wrap; with one image, prev/next are hidden; Esc / backdrop / close dismiss and focus returns; Ctrl/Cmd-click still opens the raw file in a new tab; confirm the no-JS fallback (anchor still has href/target).