diff --git a/tgui/packages/tgui/hotkeys.ts b/tgui/packages/tgui/hotkeys.ts index f7176bd00300..2f6579a377f4 100644 --- a/tgui/packages/tgui/hotkeys.ts +++ b/tgui/packages/tgui/hotkeys.ts @@ -73,7 +73,10 @@ const keyCodeToByond = (keyCode: number) => { const handlePassthrough = (key: KeyEvent) => { const keyString = String(key); // In addition to F5, support reloading with Ctrl+R and Ctrl+F5 - if (keyString === 'Ctrl+F5' || keyString === 'Ctrl+R') { + if ( + !key.event.defaultPrevented && + (keyString === 'Ctrl+F5' || keyString === 'Ctrl+R') + ) { location.reload(); return; } diff --git a/tgui/packages/tgui/interfaces/KeyBinds.js b/tgui/packages/tgui/interfaces/KeyBinds.js index 0325ead1058c..5bdecf871c6b 100644 --- a/tgui/packages/tgui/interfaces/KeyBinds.js +++ b/tgui/packages/tgui/interfaces/KeyBinds.js @@ -279,6 +279,8 @@ export class ButtonKeybind extends Component { }); this.finishTimerStart(2000); globalEvents.on('keydown', this.preventPassthrough); + globalEvents.on('key', this.preventPassthrough); + globalEvents.on('keyup', this.preventPassthrough); } doBlur() { @@ -287,6 +289,8 @@ export class ButtonKeybind extends Component { keysDown: {}, }); globalEvents.off('keydown', this.preventPassthrough); + globalEvents.off('key', this.preventPassthrough); + globalEvents.off('keyup', this.preventPassthrough); } render() {