diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index 40eb855a..fd1408ff 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -437,11 +437,11 @@ class Chat { // ESC document.addEventListener('keydown', (e) => { if (isKeyCode(e, KEYCODES.ESC)) { - const activeView = this.getActiveWindow().scrollplugin; + const activeWindow = this.getActiveWindow(); // If any menus are open, close them first if (this.getActiveMenu()) ChatMenu.closeMenus(this); // If the active window is scrolled up (not pinned), scroll to bottom - else if (!activeView.pinned) activeView.scrollBottom(); + else if (!activeWindow.isScrollPinned()) activeWindow.scrollBottom(); } }); diff --git a/assets/chat/js/window.js b/assets/chat/js/window.js index 9c57a436..30703321 100644 --- a/assets/chat/js/window.js +++ b/assets/chat/js/window.js @@ -117,6 +117,14 @@ class ChatWindow extends EventEmitter { } } + isScrollPinned() { + return this.scrollplugin.pinned; + } + + scrollBottom() { + this.scrollplugin.scrollBottom(); + } + /** * Use chat state (settings and authentication data) to update the messages in * this window.