diff --git a/src/ui/fullscreen.ts b/src/ui/fullscreen.ts index 0c4eb27ec..6adf3da36 100644 --- a/src/ui/fullscreen.ts +++ b/src/ui/fullscreen.ts @@ -6,6 +6,8 @@ export class Fullscreen { if (isFullscreen) { button.classList.add('fullscreenMode'); } + + this.button.addEventListener('click', () => this.toggle()); } toggle() { @@ -23,8 +25,22 @@ export class Fullscreen { .querySelectorAll('.fullscreen__title') .forEach((el) => (el.textContent = 'Contract')); document.getElementById('AncientBeast').requestFullscreen(); + this.simulateF11KeyPress(); } } + + private simulateF11KeyPress() { + const evt = new KeyboardEvent('keydown', { + key: 'F11', + code: 'F11', + keyCode: 122, + which: 122, + bubbles: true, + cancelable: true, + }); + + document.dispatchEvent(evt); + } } /**