Merge pull request #495 from LemmyNet/comment_scroll_bug

Fix comment scroll bug. Fixes #492
This commit is contained in:
Dessalines 2021-11-18 12:21:11 -05:00 committed by GitHub
commit ebf216ccc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,11 +218,15 @@ export class Post extends Component<any, PostState> {
} }
scrollCommentIntoView() { scrollCommentIntoView() {
var elmnt = document.getElementById(`comment-${this.state.commentId}`); let commentElement = document.getElementById(
elmnt.scrollIntoView(); `comment-${this.state.commentId}`
elmnt.classList.add("mark"); );
this.state.scrolled = true; if (commentElement) {
this.markScrolledAsRead(this.state.commentId); commentElement.scrollIntoView();
commentElement.classList.add("mark");
this.state.scrolled = true;
this.markScrolledAsRead(this.state.commentId);
}
} }
get checkScrollIntoCommentsParam() { get checkScrollIntoCommentsParam() {