diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index c0f2e020..16caa65b 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -415,7 +415,12 @@ class Chat { // ESC document.addEventListener('keydown', (e) => { - if (isKeyCode(e, KEYCODES.ESC)) ChatMenu.closeMenus(this); // ESC key + if (isKeyCode(e, KEYCODES.ESC)) { + // If any menus are open, close them first + if ([...this.menus].some(([, menu]) => menu.visible)) ChatMenu.closeMenus(this); + // If chat is not pinned, scroll to bottom + else if (!this.mainwindow.scrollplugin.pinned) this.mainwindow.scrollplugin.scrollBottom(); + } }); // Visibility