From 0fa4c11ea6fd0d73756554bf5bbcc262ccaac41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 18 Jan 2021 14:52:52 -0500 Subject: [PATCH] fix: don't chagne scrollTop if at the top of page --- public/src/client/topic/posts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 8e14941524..e0dd634049 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -210,7 +210,9 @@ define('forum/topic/posts', [ html.insertBefore(before); // Now restore the relative position the user was on prior to new post insertion - $(window).scrollTop(scrollTop + ($(document).height() - height)); + if (scrollTop > 0) { + $(window).scrollTop(scrollTop + ($(document).height() - height)); + } } else { components.get('topic').append(html); }