-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added hotkey for ESC key to scroll chat to bottom #547
Conversation
bf62375
to
44355fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind merging in master and making it so that if an event bar event is selected, ESC
would unselect it? This can occur after the menu check, but before the pinned check.
Also, I'd like you to remove the comments and switch to if
statements that aren't single-line/braceless.
assets/chat/js/chat.js
Outdated
@@ -415,7 +415,13 @@ class Chat { | |||
|
|||
// ESC | |||
document.addEventListener('keydown', (e) => { | |||
if (isKeyCode(e, KEYCODES.ESC)) ChatMenu.closeMenus(this); // ESC key | |||
if (isKeyCode(e, KEYCODES.ESC)) { | |||
const activeView = this.getActiveWindow().scrollplugin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can go ahead and add a method to ChatWindow
that scrolls it to the bottom so you don't have to interface with its scroll plugin directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Added methods on ChatWindow to interface with its scroll plugin
Updated! I also added clearing the user focus as well, as the lowest priority check. Let me know if you think that is okay or if I should removed that part entirely. |
This update introduces a hotkey function similar to Discord's. When the chat window is scrolled up, pressing
ESC
will bring the view back to the latest messages.In DGG, if the chat is not already pinned to the bottom, pressing
ESC
will scroll it down. However, if any menus are open (e.g., emote or settings),ESC
will first close those menus instead of scrolling. Scrolling will only occur when there are no other actions forESC
to perform.