Skip to content

Commit

Permalink
Merge pull request #495 from LemmyNet/comment_scroll_bug
Browse files Browse the repository at this point in the history
Fix comment scroll bug. Fixes #492
  • Loading branch information
dessalines authored Nov 18, 2021
2 parents 3f763b6 + aff768e commit ebf216c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/shared/components/post/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,15 @@ export class Post extends Component<any, PostState> {
}

scrollCommentIntoView() {
var elmnt = document.getElementById(`comment-${this.state.commentId}`);
elmnt.scrollIntoView();
elmnt.classList.add("mark");
this.state.scrolled = true;
this.markScrolledAsRead(this.state.commentId);
let commentElement = document.getElementById(
`comment-${this.state.commentId}`
);
if (commentElement) {
commentElement.scrollIntoView();
commentElement.classList.add("mark");
this.state.scrolled = true;
this.markScrolledAsRead(this.state.commentId);
}
}

get checkScrollIntoCommentsParam() {
Expand Down

0 comments on commit ebf216c

Please sign in to comment.