Skip to content

Screenshots lightbox: show the clicked screen at once, never the previous one - #18

Merged
ndbroadbent merged 1 commit into
mainfrom
lightbox-stale
Dec 2, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
lightbox-stale

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

A live bug on https://visualci.com/screenshots/, from Nathan: open a screenshot, press Esc, click another, and the previous one shows; after a delay the new image loads and replaces it.

Cause: the lightbox reused one <img> and changed its srcset and src. The browser keeps painting the old picture until the new one has loaded, which with srcset and a 2x copy on a high-density screen can take a while.

Fix:

  • Every screen and version gets a new <img>, in a frame of the image's shape.
  • Until it loads, the clicked card's thumbnail (already loaded) fills the frame, blurred, so the clicked screen shows at once and never the one before.
  • A 2x copy that fails to load falls back to the 1x one, as before.

Test: scripts/screenshots/lightbox.mjs, which checks.mjs runs in the visual job. At device scale 2, it answers the gallery's 1x images at once and delays the 2x copies by 3 s. It opens one screen, presses Esc, clicks another, and checks that the lightbox shows only the clicked screen's pictures (its thumbnail), then its own image once that arrives. It skips when the page was built without the gallery's manifest.

  • Against this branch's build (served from docspring-dev): passes.
  • Against production's current page: fails, with no picture of the clicked screen shown while the old one stays painted.

Review: no screenshots change (the lightbox isn't captured).

…w image per screen, with its card's thumbnail blurred in a frame of the right shape until it loads), never the one opened before; a Playwright check with throttled 2x images (lightbox.mjs, run by checks.mjs)
@visualci-com

visualci-com Bot commented Dec 2, 2026

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #105 · 293 unchanged · no changes

This PR vs base: 41 changed since #96, across 1 build

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent merged commit cda27a3 into main Dec 2, 2026
10 checks passed
@ndbroadbent
ndbroadbent deleted the lightbox-stale branch December 2, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant