Fix lightbox blocking clicks on page elements

The CSS change in 39575a0 added `display: flex` to the lightbox dialog
unconditionally, which overrode the browser's default `display: none`
for closed dialogs. This made the invisible lightbox overlay intercept
all clicks on the page.

Move flexbox properties to the `&[open]` selector so they only apply
when the dialog is actually open.

Also fix typo: `innerHtml` → `innerHTML` (capital H).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mike Dalessio
2026-01-28 17:51:32 -05:00
parent a67dea6347
commit 17b7af9b92
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -3,14 +3,11 @@
--dialog-duration: 350ms;
--lightbox-padding: 3vmin;
align-items: center;
background-color: transparent;
block-size: 100dvh;
border: 0;
display: flex;
inline-size: 100dvw;
inset: 0;
justify-content: center;
margin: auto;
max-height: unset;
max-width: unset;
@@ -39,6 +36,9 @@
/* Open state */
&[open],
&[open]::backdrop {
align-items: center;
display: flex;
justify-content: center;
opacity: 1;
@starting-style {
@@ -30,7 +30,7 @@ export default class extends Controller {
reset() {
this.zoomedImageTarget.src = ""
this.captionTarget.innerHtml = "&nbsp;"
this.captionTarget.innerHTML = "&nbsp;"
this.dispatch('closed')
}