Skip to content

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

fix([route-medialightbox-settings-drawer-through]): address codex review

[._.]/ Adam Eivya32f8f4bcb35
diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsx
index 697e3fe9b5..7c45d13a7e 100644
--- a/client/src/components/media/MediaLightbox.jsx
+++ b/client/src/components/media/MediaLightbox.jsx
@@ -12,12 +12,19 @@ import { copyToClipboard } from '../../lib/clipboard';
// Intentionally NOT migrated to <ui/Modal> or <components/Drawer>. The
// prev/next buttons sit as viewport-edge siblings of the card (not children
// of a constrained panel box), and the Esc cascade refineOpen → fullScreen
-// → close is layered into the window keydown handler below. Both wrappers
-// would add their own flat Esc listener that fights the cascade, and Drawer
-// is a right-side slide-in over a normal page — SettingsPane below is an
-// inline layout sibling of the image, not a slide-in. (A mobile tap-to-open
-// bottom-sheet drawer existed pre-ed0e4859 and was removed because it
-// covered the image area in fullscreen.)
+// → close is layered into the window keydown handler below.
+// - Modal wraps children in a panel container (which the viewport-edge
+// chevrons can't live inside) and owns Esc via a stack-aware global
+// handler that stopImmediatePropagation's the keystroke — the lightbox's
+// own window keydown listener never sees Esc and the cascade dies. Could
+// be threaded through Modal's onEsc prop, but at the cost of bypassing
+// the stack model for this one caller.
+// - Drawer is a right-side slide-in over a normal page; SettingsPane below
+// is an inline layout sibling of the image, not a slide-in. Its flat Esc
+// listener also calls onClose directly, racing the lightbox's own window
+// keydown listener.
+// (A mobile tap-to-open bottom-sheet drawer existed pre-ed0e4859 and was
+// removed because it covered the image area in fullscreen.)
const NOTE_MAX = 2000;
const NOTE_DEBOUNCE_MS = 500;