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

Fix scrolling chat when in the background #4979

Merged

Conversation

nickvergessen
Copy link
Member

Before scrollTo() was used, but this does not work when the window is not visible.
So now when the chat is in the background we scroll only half a line and stop following.
The user will see that something happened and have the anchor to jump to the bottom.

Same author (half a line) New author (half avatar)
Bildschirmfoto von 2021-01-20 16-35-17 Bildschirmfoto von 2021-01-20 16-33-34

cc @ma12-co @jancborchardt The main question is if the "scroll only half" behaviour is actually wanted, or if we should just scrolldown fully (as it was attempted to, but didn't do because scrollTo() only works on visible windows)

Before scrollTo() was used, but this does not work when the window is not visible.
So now when the chat is in the background we scroll only half a line and stop following.
The user will see that something happened and have the anchor to jump to the bottom.

Signed-off-by: Joas Schilling <coding@schilljs.com>
top: this.scroller.scrollHeight,
behavior: 'smooth',
})
this.setChatScrolledToBottom(true)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is actually what the biggest problem was. It removed the scroll-to-bottom button, although it wasn't scrolled to the bottom

@marcoambrosini marcoambrosini merged commit 1a7a81e into master Jan 20, 2021
@marcoambrosini marcoambrosini deleted the bugfix/noid/fix-scrolling-chat-when-in-background branch January 20, 2021 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants