From 492378692776d21925fa3507034088371f712c16 Mon Sep 17 00:00:00 2001 From: Ridley Combs Date: Tue, 19 Aug 2025 06:25:42 -0700 Subject: [PATCH] [Lightbox] prevent browser-default escape key behavior (#8859) Some browsers exit fullscreen when the escape key is pressed without `preventDefault()` being called; we don't want that when we're handling the press ourselves. --- src/view/com/lightbox/Lightbox.web.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/view/com/lightbox/Lightbox.web.tsx b/src/view/com/lightbox/Lightbox.web.tsx index 97811da7f1..ab50fbcf05 100644 --- a/src/view/com/lightbox/Lightbox.web.tsx +++ b/src/view/com/lightbox/Lightbox.web.tsx @@ -76,6 +76,7 @@ function LightboxInner({ const onKeyDown = useCallback( (e: KeyboardEvent) => { if (e.key === 'Escape') { + e.preventDefault() onClose() } else if (e.key === 'ArrowLeft') { onPressLeft()