mirror of
https://github.com/immich-app/immich.git
synced 2025-06-23 15:30:51 -04: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:
parent
caf11fbb96
commit
38e68d16f9
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user