Selaa lähdekoodia

Reset scroll (#2842)

Address some of https://github.com/FreshRSS/FreshRSS/issues/2836
This patch resets the scrollbar to the top when a FreshRSS page is
initialised.
Makes sure that when a FreshRSS page is restored in a Web browser
session, we do not hit the problematic situation when the content is
refreshed but the scrollbar moved back to where it was, potentially
erroneously marking as read many as read, of landing on the wrong focus.
Alexandre Alapetite 6 vuotta sitten
vanhempi
commit
8fabed337a
1 muutettua tiedostoa jossa 1 lisäystä ja 0 poistoa
  1. 1 0
      p/scripts/main.js

+ 1 - 0
p/scripts/main.js

@@ -1542,6 +1542,7 @@ function init_normal() {
 }
 }
 
 
 function init_beforeDOM() {
 function init_beforeDOM() {
+	document.scrollingElement.scrollTop = 0;
 	if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) {
 	if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) {
 		init_normal();
 		init_normal();
 	}
 	}