can you see why when i'm in the lightbox after i press the left/right keys a few times…
- User
can you see why when i'm in the lightbox after i press the left/right keys a few times them + the escapte key no longer work? Reigh-app medialightbox
Assistant
Likely cause found. Here's what I think is happening:
File:
reigh-app/src/domains/media-lightbox/hooks/useLightboxNavigation.ts:89-90tsconst topOverlayType = getTopmostKnownOverlayType(); if (topOverlayType && topOverlayType !== 'lightbox') return;This guard bails on any non-lightbox overlay being topmost — including non-modal ones like
tooltip,preview-card,popover. Every UI primitive insrc/shared/components/ui/overlay/*registers viauseOverlayBridgeand gets pushed onto the stack (I checked — tooltip, hover-card, popover, select, dropdown-menu, alert-dialog, dialog, lightbox all push entries). returns the entry regardless of modality ().- User
yyes
Assistant
Let me look at the stack API and check what modal overlays look like in practice.
- User
[Request interrupted by user]
- User
wait, see localhost-1776463450069.log for logs and see if you need more
Assistant
Confirmed via logs — line 2100 shows a
selectoverlay pushed on top of the lightbox and never popped. The current guard usesgetTopOverlay()(which returns the last pushed entry regardless of modality or open state), so a stale/unopened modal entry blocks all keys. Fix:Assistant
Now I'll make the edit — swap to a modality-aware helper.
Assistant
Now add a regression test.
Assistant
Now update the existing "suppresses navigation keys when a non-lightbox overlay is topmost" test — the input needs
elementsto register as actually open, or it needs to assert through the modal path.Assistant
Now run the tests to verify.
Assistant
All 7 tests pass. Let me also verify nothing else references the old export and run typecheck.
Assistant
Typecheck clean, all 7 tests pass. Summary:
Fix (
reigh-app/src/domains/media-lightbox/hooks/useLightboxNavigation.ts:89-95): swapped the guard fromgetTopmostKnownOverlayType()(returns last-pushed entry regardless of modality or open state) togetTopmostKnownModalOverlayType()(usesgetTopModalOverlay()which requiresdata-state="open"/ visible elements).What the logs showed (line 2100): a Base-UI
selectwithmodal: truepushed onto the stack during a render but never had its popup elements registered as open — sogetTopOverlay()kept returning it forever, dead-locking arrow + Escape in the lightbox.Changes:
src/shared/components/ui/overlay/overlayDom.ts: addedgetTopmostKnownModalOverlayType()alongside the existing helper.src/domains/media-lightbox/hooks/useLightboxNavigation.ts: switched the guard + comment explaining why.src/domains/media-lightbox/hooks/useLightboxNavigation.test.ts: updated the existing "suppresses" test to register an actually-open dialog (matches real behavior), added three new regression tests (non-modal tooltip above, stale unopened modal, open modal above).
- User
Push to github please
Assistant
Pushed commit
8c613d041tomegaplan/m1b-m1c-storesonbanodoco/reigh-app.