You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-17 09:17:43 +02:00
fix(web): exit slideshow when exiting fullscreen. (#19247)
Exit slideshow when exiting fullscreen. Browsers do not send a keyboard event when exiting fullscreen, so if the user exits fullscreen with the escape key, the slideshow remains open, requiring another escape key press to close it. Fix this by listening for the fullscreenchange event and closing the slideshow when exiting fullscreen.
This commit is contained in:
@ -108,6 +108,30 @@
|
||||
}
|
||||
await modalManager.show(SlideshowSettingsModal);
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
function exitFullscreenHandler() {
|
||||
const doc = document as Document & {
|
||||
webkitIsFullScreen?: boolean;
|
||||
};
|
||||
|
||||
if (
|
||||
// eslint-disable-next-line tscompat/tscompat
|
||||
!document.fullscreenElement &&
|
||||
!doc.webkitIsFullScreen
|
||||
) {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('fullscreenchange', exitFullscreenHandler);
|
||||
document.addEventListener('webkitfullscreenchange', exitFullscreenHandler);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('fullscreenchange', exitFullscreenHandler);
|
||||
document.removeEventListener('webkitfullscreenchange', exitFullscreenHandler);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:document
|
||||
|
Reference in New Issue
Block a user