Click a thumbnail, see the full image in an overlay, step through the rest of the gallery without leaving it. Built on the same native <dialog> element as the modal note.
Pseudocode
Structure
- A grid of thumbnail
<button>s (images are interactive here, so buttons rather than plain<img>s), each tied to an index into a shared list of images. - A single
<dialog>reused for every thumbnail — its content is swapped by JS rather than having one dialog per image.
Style
- The dialog is sized close to the full viewport for the “full image” feel, with the image itself constrained to fit inside it.
Features
- Clicking a thumbnail opens the dialog and shows that image.
- Prev/next buttons — and, since the dialog already owns keyboard focus, the ← → arrow keys too — step through the same array the thumbnails came from, wrapping around at the ends.