diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index 47079651..05293cc1 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -444,6 +444,8 @@ class Chat { this.eventBar.unselect(); } else if (!activeWindow.isScrollPinned()) { activeWindow.scrollBottom(); + } else if (this.userfocus.isFocused()) { + this.userfocus.clearFocus(); } } }); diff --git a/assets/chat/js/focus.js b/assets/chat/js/focus.js index 7ff52857..9330c16a 100644 --- a/assets/chat/js/focus.js +++ b/assets/chat/js/focus.js @@ -24,7 +24,7 @@ class ChatUserFocus { this.toggleFocus(t.text()); } else if (t.hasClass('flair')) { this.toggleFocus(t.data('flair'), true); - } else if (this.focused.length > 0) { + } else if (this.isFocused()) { this.clearFocus(); } } @@ -43,6 +43,10 @@ class ChatUserFocus { return this; } + isFocused() { + return this.focused.length > 0; + } + addCssRule(value, isFlair) { let rule; if (isFlair) { @@ -92,7 +96,7 @@ class ChatUserFocus { } redraw() { - this.chat.ui.toggleClass('focus', this.focused.length > 0); + this.chat.ui.toggleClass('focus', this.isFocused()); } }