From 672146752e41e22739cd702f4a808db8760e8760 Mon Sep 17 00:00:00 2001 From: Pio Rasch-Halvorsen Date: Sat, 3 Dec 2022 01:13:15 +0100 Subject: [PATCH] fix: prevent the escape key from minimizing Safari (#265) * fix: prevent the escape key from minimizing Safari Safari uses the escape key as a shortcut for exiting full screen. Stopping propagation is _not_ enough to prevent this behaviour. Use `preventDefault` instead of `stopPropagation` to avoid messing with the users' browser experience. Closes: #264 * fix: stop propagation in addition to preventing default --- src/InternalEvents.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/InternalEvents.tsx b/src/InternalEvents.tsx index 0347000..36d1e66 100644 --- a/src/InternalEvents.tsx +++ b/src/InternalEvents.tsx @@ -42,6 +42,7 @@ function useToggleHandler() { Escape: (event: KeyboardEvent) => { if (showing) { event.stopPropagation(); + event.preventDefault(); options.callbacks?.onClose?.(); }