4
0
Эх сурвалжийг харах

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.
aarnej 1 жил өмнө
parent
commit
e9f3922010

+ 1 - 0
p/scripts/main.js

@@ -2028,6 +2028,7 @@ function init_normal() {
 }
 }
 
 
 function init_main_beforeDOM() {
 function init_main_beforeDOM() {
+	history.scrollRestoration = 'manual';
 	document.scrollingElement.scrollTop = 0;
 	document.scrollingElement.scrollTop = 0;
 	init_shortcuts();
 	init_shortcuts();
 	if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) {
 	if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) {