In game chat not scrolling

In game chat now opens at first messages.

Before it was opening at the most recent message.

Also, when posting a new message, it doesn’t scroll down as before.

11 Likes

Thanks, I’ll get it fixed

6 Likes

Should be better now

7 Likes

I confirm that it’s better, and thank you, but in some games, not always, the chat opens in the middle

1 Like

the chat also has the same darn scrollbug, refreshing the page fixes it but its still not ideal ://

3 Likes

Fixed

You’re talking about the normal chat? I can’t reproduce that if I switch between channels, where/how are you seeing that?

3 Likes

it happens ~all the time, just leave the chat open in tab, let you computer go to sleep, then get back and the scrollbug happens

2 Likes

Interesting, I’m having trouble reproducing that :frowning:

really weird, i get that scroll bug almost daily o.o

i think you already fixed it once but it then came back? IIRC it first started happening when we got this thing
Screen Shot 2022-04-30 at 1.21.20

1 Like

Can you reproduce it on demand? Or does your laptop have to be suspended for a good long while?

I tried to debug it about a year ago, and I think there’s a race condition somewhere between auto-scrolling to the last message and getting a new message.

Used this patch to reproduce:

diff --git a/src/lib/chat_manager.ts b/src/lib/chat_manager.ts
index a0a2a4c0..d6ad5e72 100644
--- a/src/lib/chat_manager.ts
+++ b/src/lib/chat_manager.ts
@@ -751,12 +751,35 @@ export class ChatChannelProxy extends TypedEventEmitter<Events> {
 class ChatManager {
     channels: { [channel: string]: ChatChannel } = {};

+    chatId: number = 1;
+
+    cry = () => {
+        const message: ChatMessage = {
+            channel: 'global-english',
+            username: 'butt',
+            id: this.chatId,
+            ranking: 420,
+            professional: false,
+            ui_class: '',
+            message: {
+                i: 'chatId-' + this.chatId,
+                t: Date.now() / 1000,
+                m: this.chatId + ' ' + 'お尻 '.repeat(Math.random() * 69),
+            },
+        };
+        this.onMessage(message);
+        this.chatId++;
+        setTimeout(this.cry);
+    };
+
     constructor() {
         socket.on("chat-message", this.onMessage);
         socket.on("chat-topic", this.onTopic);
         socket.on("chat-message-removed", this.onMessageRemoved);
         socket.on("chat-join", this.onJoin);
         socket.on("chat-part", this.onPart);
+
+        setTimeout(this.cry, 3000);
     }

     onTopic = (obj: TopicMessage) => {

It spams chat with fake incoming messages. To reproduce the bug, move mouse cursor inside the chat window while the messages are coming in. After a while it stops auto-scrolling. I think window.requestAnimationFrame might be at fault, but I’m not a JS guy.

7 Likes

That’s awesome, thanks for working on that @Igloo

Ok I think I have a fix, let me know if y’all still see it (after you’ve refreshed of course), and let me know if you notice any quirks.

8 Likes

I just got hit with the scrollbug on english chat.

For extra information, it has been around for 1-2 years, not longer.

A related issue is, it used to be that when I am on another tab, a number inside a parantheses used to show the number of new messages on the OGS tab. So, it was easy to notice new messages and come back to OGS tab. This changed at the same time when scrollbug appeared.

(I use google chrome)

1 Like

I opened a new tab after the above report and got hit with the scrollbug again (within 40 minutes).

1 Like

Somehow its gotten worse now >____>

1 Like

I’d updated it to leave the browser to deal with it, apparently the browser sucks at dealing with it too.

2 Likes