Button to scroll to recent live chats (scroll to bottom) #6268

Merged
saltrafael merged 3 commits from scrollback into master 2021-06-22 16:29:22 +02:00
Showing only changes of commit 2fcc57dbba - Show all commits

View file

@ -84,8 +84,8 @@ export default function LivestreamComments(props: Props) {
function handleScroll() {
if (discussionElement) {
const negativeCommentHeight = (-1 * commentElement.offsetHeight);
const isAtRecent = discussionElement.scrollTop >= negativeCommentHeight;
const negativeCommentHeight = commentElement && (-1 * commentElement.offsetHeight);
const isAtRecent = negativeCommentHeight && (discussionElement.scrollTop >= negativeCommentHeight);
setScrollBottom(isAtRecent);
}