From e70133f5f4978a05414d464800096ec8ff31d600 Mon Sep 17 00:00:00 2001 From: Andrew S Date: Thu, 31 Oct 2024 00:42:33 -0500 Subject: [PATCH] Fix [BUG] Hotkeys Not Working After Using Fullscreen Button Persists #279 --- chrome/player/ui/InterfaceController.mjs | 1 - chrome/player/ui/KeybindManager.mjs | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/player/ui/InterfaceController.mjs b/chrome/player/ui/InterfaceController.mjs index 43506f7..bac9742 100644 --- a/chrome/player/ui/InterfaceController.mjs +++ b/chrome/player/ui/InterfaceController.mjs @@ -1031,7 +1031,6 @@ export class InterfaceController { const newValue = force === undefined ? !document.fullscreenElement : force; if (newValue) { await document.documentElement.requestFullscreen(); - DOMElements.playerContainer.focus(); } else if (document.exitFullscreen && document.fullscreenElement) { document.exitFullscreen(); } diff --git a/chrome/player/ui/KeybindManager.mjs b/chrome/player/ui/KeybindManager.mjs index e11f1b5..9054c17 100644 --- a/chrome/player/ui/KeybindManager.mjs +++ b/chrome/player/ui/KeybindManager.mjs @@ -16,10 +16,15 @@ export class KeybindManager extends EventEmitter { this.keybindMap.set(keybind, DefaultKeybinds[keybind]); } } + DOMElements.playerContainer.addEventListener('keydown', (e) => { this.onKeyDown(e); }); + document.addEventListener('keydown', (e) => { + this.onKeyDown(e); + }); + this.on('HidePlayer', (e) => { this.client.interfaceController.toggleHide(); }); @@ -269,6 +274,7 @@ export class KeybindManager extends EventEmitter { if (this.handleKeyString(keyString, e)) { e.preventDefault(); + e.stopPropagation(); } } }