Skip to content

Commit

Permalink
PM scroll fix when content appears below chat
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffputz committed Aug 29, 2022
1 parent ec8e764 commit 37fb5bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PopForums.Web/wwwroot/lib/PopForums/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@popworldmedia/popforums",
"version": "19.0.0-prerelease.353",
"version": "19.0.0-prerelease.354",
"description": "POP Forums client side",
"scripts": {},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export class PrivateMessageState extends StateBase {
this.connection.on("addMessage", function(message: PrivateMessage) {
let messageRow = self.populateMessage(message);
let parent = self.postStream.parentElement;
let isBottom = parent.scrollHeight - parent.scrollTop - parent.clientHeight < 1;
let isBottom = parent.scrollHeight - parent.scrollTop - parent.clientHeight < 200;
self.postStream.append(messageRow);
if (isBottom)
(self.postStream.lastChild as HTMLElement).scrollIntoView(true);
(self.postStream.lastChild as HTMLElement).scrollIntoView({ behavior: "smooth", block: "end", inline: "start" });
self.ackRead();
});
this.connection.onreconnected(async () => {
Expand Down

0 comments on commit 37fb5bb

Please sign in to comment.