Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: restore media lightbox Escape cascade (#4260)
[._.]/ Adam Eivy14816fdf3370
diff --git a/.changelog/next/fixed-issue-4260.md b/.changelog/next/fixed-issue-4260.mdnew file mode 100644index 0000000000..4df9e594b1--- /dev/null+++ b/.changelog/next/fixed-issue-4260.md@@ -0,0 +1 @@+- Media previews use Esc to leave full screen or close a prompt panel before closing the viewer.diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsxindex 72a257603f..61e6f30dce 100644--- a/client/src/components/media/MediaLightbox.jsx+++ b/client/src/components/media/MediaLightbox.jsx@@ -256,7 +256,6 @@ export default function MediaLightbox({aria-label={`Media viewer — ${item.filename || item.key || 'item'}`}className={`fixed inset-0 z-50 bg-black/90 flex items-center justify-center ${overlayPad}`}onClick={onClose}- onKeyDown={(e) => e.key === 'Escape' && onClose()}>{hasPrevious && (<buttondiff --git a/client/src/components/media/MediaLightbox.test.jsx b/client/src/components/media/MediaLightbox.test.jsxindex e3db2f1ae4..b58cecfd1b 100644--- a/client/src/components/media/MediaLightbox.test.jsx+++ b/client/src/components/media/MediaLightbox.test.jsx@@ -2,12 +2,14 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';import { fireEvent, render, screen, waitFor } from '@testing-library/react';import MediaLightbox from './MediaLightbox';-// The footer's AddToCollectionMenu and the (closed) PromptRefineModal pull the-// whole API surface (and useProviderModels) into the import graph. Neither is-// under test here, so stub them to inert nodes — that keeps the test focused-// on MediaLightbox's own <video> markup and off the network.+// The footer's AddToCollectionMenu and prompt modals pull the whole API surface+// (and useProviderModels) into the import graph. Keep the mocks inert except+// for PromptRefineModal's open state, which lets the Escape regression assert+// that it closes without pulling its provider hooks into the test.vi.mock('./AddToCollectionMenu', () => ({ default: () => null }));-vi.mock('./PromptRefineModal', () => ({ default: () => null }));+vi.mock('./PromptRefineModal', () => ({+ default: ({ open }) => open ? <div data-testid="refine-modal" /> : null,+}));vi.mock('./PromptFromMedia', () => ({ default: () => null, PromptFromMediaModal: () => null }));const videoItem = {@@ -114,6 +116,35 @@ describe('MediaLightbox overlay portal', () => {});});+describe('MediaLightbox Escape cascade', () => {+ it('exits full screen without closing the lightbox', () => {+ const onClose = vi.fn();+ render(<MediaLightbox item={imageItem} onClose={onClose} />);++ fireEvent.keyDown(screen.getByRole('button', { name: 'Full screen' }), { key: 'f' });+ const exitFullScreen = screen.getByRole('button', { name: 'Exit full screen' });++ fireEvent.keyDown(exitFullScreen, { key: 'Escape' });++ expect(onClose).not.toHaveBeenCalled();+ expect(screen.getByRole('button', { name: 'Full screen' })).toBeTruthy();+ });++ it('closes the refine modal without closing the lightbox', () => {+ const onClose = vi.fn();+ render(<MediaLightbox item={imageItem} onClose={onClose} />);++ fireEvent.click(screen.getByRole('button', { name: 'Refine Prompt' }));+ const refineModal = screen.getByTestId('refine-modal');++ fireEvent.keyDown(refineModal, { key: 'Escape' });++ expect(onClose).not.toHaveBeenCalled();+ expect(screen.queryByTestId('refine-modal')).toBeNull();+ expect(screen.getByRole('dialog')).toBeTruthy();+ });+});+describe('MediaLightbox route-changing actions', () => {it('closes the preview before Send to Video runs so query cleanup cannot override navigation', () => {const calls = [];