Skip to content
PifeatureWeb2 files · +202 −109

Add image preview lightbox and click-outside close in Svelte composer

Session from pi-web on Hugging Face by woxQAQ · MIT · condensed by Coders Talk

7msession
1interventions
GOAL

Remove the default attachment count text in the composer bar, add a way to preview attached images in a lightbox, and make the lightbox close when clicking outside the image.

  1. Prompt · +0
    Remove the 'x image(s) attached' text in ComposerBar.svelte
  2. Agent did · +0m
    Traced attachmentSummary/attachmentNotice logic in ComposerBar.svelte, simplified it to only show the temporary notice (not the default count text), and verified with pnpm run build:web
  3. Prompt · +1m
    Support viewing attached images
  4. Agent did · +1m
    Found existing ImageLightbox component, wired attachment thumbnails to open it, added open/close/prev/next state, mounted the lightbox, and confirmed build:web passed
  5. Prompt · +5m
    In ImageLightbox.svelte, support closing by clicking the backdrop, not just the close button
  6. Agent did · +5m
    Added onclick={onClose} to the dialog stage and stopPropagation on buttons and image/footer areas, then confirmed build:web passed
  7. Intervention · +6m
    Tested it and clicking the backdrop still didn't close the lightbox, so told the agent it wasn't working
    Why: It said it fixed it and the build passed, but I actually tried clicking the mask and nothing happened.
  8. Agent did · +7m
    Re-read the component, found the viewport div was still intercepting all clicks, narrowed stopPropagation to just the image frame so clicking empty space now closes it, and re-ran build:web successfully
  9. Outcome · +7m
    Three composer/lightbox changes shipped across ComposerBar.svelte and ImageLightbox.svelte, each verified with a passing pnpm run build:web
VERDICT

Next time I'd ask upfront for click-outside-to-close behavior along with the lightbox feature, since it's an obvious pairing. The correction that actually mattered was telling the agent the backdrop click still didn't work after it claimed success — it turned out the viewport div was still swallowing the click, and only my re-test caught that the build passing didn't mean the feature worked.

I tried this · 0

Discussion · 0

How Builds work