Fix lightbox close: only close on overlay/image click, not inner content

The global click handler was removing any .image-lightbox on any click
inside it, which broke export/import/identity wizards (clicking radio
buttons or text inputs closed the wizard). Now only closes on overlay
background click or image click, preserving form interaction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scott Reimers 2026-04-06 01:07:25 -04:00
parent 4379b6fdfc
commit a349d33422

View file

@ -2043,9 +2043,10 @@ document.addEventListener('click', async (e) => {
// --- Video expand/collapse (double-click to toggle fullscreen-like view) ---
// --- Image lightbox (click to open full-size popup) ---
document.addEventListener('click', (e) => {
// Close lightbox on click
const lb = e.target.closest('.image-lightbox');
if (lb) { lb.remove(); return; }
// Close lightbox on click — overlay background or image inside it (not form content)
if (e.target.classList.contains('image-lightbox')) { e.target.remove(); return; }
const lbParent = e.target.closest('.image-lightbox');
if (lbParent && e.target.tagName === 'IMG') { lbParent.remove(); return; }
const img = e.target.closest('img.post-image');
if (!img) return;