Skip to content
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

New messages don't scroll to bottom when tab is out of focus #1500

Closed
Daxterapid opened this issue Oct 24, 2023 · 13 comments · Fixed by #2214
Closed

New messages don't scroll to bottom when tab is out of focus #1500

Daxterapid opened this issue Oct 24, 2023 · 13 comments · Fixed by #2214
Assignees

Comments

@Daxterapid
Copy link

Describe the bug

Normally when a message is sent in a room, the scrollbar stays locked to the bottom. However, when a message is sent and Cinny isn't the current tab in the browser, the scrollbar stays fixed to the last read message, so you have to scroll down to see new messages every time you switch back to the Cinny tab, which I find annoying.

Reproduction

  1. Select a room
  2. Scroll to the bottom
  3. Switch to a different tab
  4. Have someone send a message in the room
  5. Switch back to Cinny
  6. Scrollbar hasn't moved

Expected behavior

The scrollbar should stay at the bottom.

Platform and versions

OS: Fedora Linux
Browser: Brave 1.57.62 Chromium: 116.0.5845.180
Cinny version: 3.0.0
Matrix homeserver: matrix.org

Additional context

No response

@soupglasses
Copy link

This seems to also happen if you are tabbed out with a separate window (like a PWA in Chromium).

@enginelesscc
Copy link

It also happens when I have the window/chat focussed.
I always have to manually scroll, for any new message.

@elkowar

This comment was marked as duplicate.

@flisk
Copy link

flisk commented Jan 20, 2025

It would be nice if a maintainer could chime in on whether the behavior described in this issue is intended and how the expectation mismatch experienced by some users should be addressed. I'd love to patch this, but I don't want to waste my time writing a fix that will be rejected.

@ajbura
Copy link
Member

ajbura commented Jan 21, 2025

the current behavior is intended as previously people had issues that "chat marked as read in background" #1116

browser doesn't have any api which can tell if application is being viewed when not in focused(i.e on second monitor) we can't really fix it without breaking it otherwise.

@elkowar
Copy link

elkowar commented Jan 22, 2025

the current behavior is intended as previously people had issues that "chat marked as read in background" #1116

browser doesn't have any api which can tell if application is being viewed when not in focused(i.e on second monitor) we can't really fix it without breaking it otherwise.

I wonder how other similar applications deal with this, as I've never really noticed issues like this anywhere else. My preferred behaviour would be that cinny scrolls down automatically, but only marks the chat as read once the window is actually focused / interacted with – which from all I gather is the behaviour of most other comparable applications.

Assuming that that's technically possible, but not necessarily desired by the maintainers, would there be a chance to make this a configurable option?

@ajbura
Copy link
Member

ajbura commented Jan 22, 2025

The reason we can do it like other applications is because we have read-receipts, which tells other person that user has read the messages in that case we can not be sure about if user has read the message or not when application is in background.

@flisk
Copy link

flisk commented Jan 22, 2025

would a patch that adds an option to disable this behavior for users who don't want it be acceptable?

@ajbura
Copy link
Member

ajbura commented Jan 22, 2025

Adding a option won't be a good fix as there may be a cleaver fix which we can think through.

@BareTuna
Copy link

browser doesn't have any api which can tell if application is being viewed when not in focused(i.e on second monitor) we can't really fix it without breaking it otherwise.

I think that just because you can see the messages on screen while the app is not in focus doesn't mean that you should send a read receipt. I think it should scroll to the bottom regardless of focus, but only mark it as read if the window has focus. (Although we should consider the case where after regaining focus you might not want to mark all those messages as read right away.)

@Daxterapid
Copy link
Author

My suggestion:

  • When the window isn't focused, stay scrolled to the bottom, but stop sending read receipts and show a "new messages" marker after the last read message
  • When the window regains focus, mark the messages as read only if there's less than, say, 20 unread messages
  • Otherwise (if there's more than 20 unread messages after focusing), display a button at the top to mark the messages read, or maybe after clicking the room again or something

(this is basically what Discord does)

You could also instead consider stopping the auto-scrolling after some amount of new unread messages (preferably after they reach the top of the screen), and then mark them read once the user scrolls to the bottom manually

@xylobol

This comment has been minimized.

@ajbura ajbura self-assigned this Feb 13, 2025
@ajbura ajbura changed the title Sent messages don't scroll to bottom when tab isn't active New messages don't scroll to bottom when tab is out of focus Feb 17, 2025
@ajbura
Copy link
Member

ajbura commented Feb 17, 2025

#2214 to fix it. Feel free to test if it is a desirable behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants