Skip to content

Commit

Permalink
ESC key will scroll chat to bottom, if chat is not already pinned.
Browse files Browse the repository at this point in the history
  • Loading branch information
Voiture-0 committed Nov 6, 2024
1 parent 27de4fd commit f6c5fcb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f6c5fcb

Please sign in to comment.