From f6520a1dbf6dc4dabbe16b0389ef018238527620 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:57:02 +1000 Subject: [PATCH] Fix close not working from fullscreen --- ui/v2.5/src/hooks/Lightbox/Lightbox.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx index 1d5965ea798..5430bede94a 100644 --- a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx +++ b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx @@ -319,12 +319,12 @@ export const LightboxComponent: React.FC = ({ }); const close = useCallback(() => { - if (!isFullscreen) { - hide(); - document.body.style.overflow = "auto"; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (Mousetrap as any).unpause(); - } else document.exitFullscreen(); + if (isFullscreen) document.exitFullscreen(); + + hide(); + document.body.style.overflow = "auto"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (Mousetrap as any).unpause(); }, [isFullscreen, hide]); const handleClose = (e: React.MouseEvent) => {