diff --git a/src/ui/fullscreen.ts b/src/ui/fullscreen.ts index 86cfa1c13..8838c1339 100644 --- a/src/ui/fullscreen.ts +++ b/src/ui/fullscreen.ts @@ -6,15 +6,7 @@ export class Fullscreen { if (isFullscreen) { button.classList.add('fullscreenMode'); } - - document.addEventListener('keydown', (event) => { - if (event.key === 'F11') { - event.preventDefault(); - this.toggle(); - } else if (event.shiftKey && event.key === 'F') { - this.toggle(); - } - }); + this.preventEscExitFullscreen(); } toggle() { @@ -34,6 +26,14 @@ export class Fullscreen { document.getElementById('AncientBeast').requestFullscreen(); } } + + private preventEscExitFullscreen() { + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && isAppInNativeFullscreenMode()) { + event.preventDefault(); + } + }); + } } /**