aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar aarnej <aarnej@iki.fi> 2024-12-04 23:16:00 +0200
committerGravatar GitHub <noreply@github.com> 2024-12-04 22:16:00 +0100
commite9f392201006c907a20ba5046252d056bd5c4426 (patch)
tree03fef0b66260ae54f25f0c6ec2492e1c7e8f7934 /p/scripts
parent01f232585061a086a711b7a4c4f2e4b33f06398f (diff)
Fix initial scroll for some browsers (#7059)
For some browsers (I tested desktop Edge and mobile Safari), setting document.scrollingElement.scrollTop to zero does not seem to be enough to reset the scroll position at start. Setting history.scrollRestoration = 'manual' seems to fix it for these browsers. Firefox seems to work without this fix but works also with it.
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 811af2f3e..f74e36553 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -2028,6 +2028,7 @@ function init_normal() {
}
function init_main_beforeDOM() {
+ history.scrollRestoration = 'manual';
document.scrollingElement.scrollTop = 0;
init_shortcuts();
if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) {