mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00: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
1 changed files with 24 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue