Skip to content

The agent that grows with you

fix(desktop): make the lightbox dialog shell an invisible frame

Brooklyn Nicholson38480654fd44
diff --git a/apps/desktop/src/components/chat/zoomable-image.test.tsx b/apps/desktop/src/components/chat/zoomable-image.test.tsx
index 7d6f7f617c5..5c9fd1ac515 100644
--- a/apps/desktop/src/components/chat/zoomable-image.test.tsx
+++ b/apps/desktop/src/components/chat/zoomable-image.test.tsx
@@ -69,6 +69,22 @@ describe('ZoomableImage lightbox', () => {
expect(lightboxImg()).toBeTruthy()
})
+ // The lightbox shell must be an invisible frame. styles.css paints every
+ // [data-slot='dialog-content'] with the themed elevated background, and that
+ // paint shows as a stray box whenever a zoomed/panned image no longer covers
+ // the whole shell (#99066).
+ it('renders the lightbox shell transparent, not as a painted box', async () => {
+ await renderImage()
+ await openLightbox()
+
+ // The dialog role lands on Radix's Dialog.Content — the same node DialogContent styles.
+ const shell = screen.getByRole('dialog') as HTMLElement
+
+ expect(shell.getAttribute('data-slot')).toBe('dialog-content')
+ // The variant opts the shell out of the shared dialog paint.
+ expect(shell.getAttribute('data-variant')).toBe('media-lightbox')
+ })
+
it('wheel zooms toward the cursor and prevents the page from scrolling', async () => {
await renderImage()
await openLightbox()
diff --git a/apps/desktop/src/components/chat/zoomable-image.tsx b/apps/desktop/src/components/chat/zoomable-image.tsx
index 552f05ec417..a006053accc 100644
--- a/apps/desktop/src/components/chat/zoomable-image.tsx
+++ b/apps/desktop/src/components/chat/zoomable-image.tsx
@@ -167,11 +167,20 @@ export function ImageLightbox({
<ZoomIn className="size-4" />
</button>
</div>
- )
- }
- className="w-auto max-h-[calc(100vh-12rem)] max-w-[calc(100vw-12rem)] border-0 bg-transparent shadow-none"
+ )}
+ className="w-auto max-h-[calc(100vh-12rem)] max-w-[calc(100vw-12rem)] border-0 bg-transparent! shadow-none!"
overlayClassName="bg-black/60"
showCloseButton={false}
+ // The media-lightbox shell variant. styles.css paints every
+ // [data-slot='dialog-content'] with the themed elevated background +
+ // --shadow-md — fine for opaque dialogs, but this shell is meant to be
+ // an invisible frame around the image: when a zoomed/panned image moves
+ // inside it, that paint shows as a stray box of shell area the image
+ // no longer covers. tailwind-merge cannot drop the base `shadow-nous`
+ // (unknown class group, so it survives next to `shadow-none`), and the
+ // attribute selector out-specifies the plain utilities — hence the
+ // important utilities and the data-variant opt-out in styles.css.
+ data-variant="media-lightbox"
>
<div className="group/lightbox relative inline-block">
<img
diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css
index 4a38242ffde..ca6046f9760 100644
--- a/apps/desktop/src/styles.css
+++ b/apps/desktop/src/styles.css
@@ -1344,6 +1344,17 @@ button {
-webkit-backdrop-filter: blur(0.75rem) saturate(1.08);
}
+/* Invisible dialog shells (the image lightbox). The rule above paints the
+ shell so a zoomed/panned image that moves inside it exposes a stray box of
+ shell paint; the variant opts out entirely — no background, no shadow, no
+ backdrop blur. */
+[data-slot='dialog-content'][data-variant='media-lightbox'] {
+ background: transparent;
+ box-shadow: none;
+ backdrop-filter: none;
+ -webkit-backdrop-filter: none;
+}
+
[data-slot='dropdown-menu-item']:focus,
[data-slot='dropdown-menu-checkbox-item']:focus,
[data-slot='dropdown-menu-radio-item']:focus {