Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4010)

Unified Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 2582643002: MD Settings: Fix scrolling when navigating Forwards from BASIC page. (Closed)
Patch Set: change code Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/basic_page_browsertest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/settings_page/main_page_behavior.js
diff --git a/chrome/browser/resources/settings/settings_page/main_page_behavior.js b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
index fd15c75f0ae7886d02fbac1ad530f248703ce354..411dbaf09bf2c67d36eb3bfa269414fdd2ccccb1 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -38,19 +38,21 @@ var MainPageBehaviorImpl = {
* @param {settings.Route} oldRoute
*/
currentRouteChanged: function(newRoute, oldRoute) {
- // Scroll to the section except for back/forward. Also scroll for any
- // back/forward navigations that are in-page.
var oldRouteWasSection =
!!oldRoute && !!oldRoute.parent && !!oldRoute.section &&
oldRoute.parent.section != oldRoute.section;
+ // Always scroll to the top if navigating from a section to the root route.
if (oldRouteWasSection && newRoute == settings.Route.BASIC) {
this.scroller.scrollTop = 0;
return;
}
+ // Scroll to the section except for back/forward. Also scroll for any
+ // in-page back/forward navigations (from a section or the root page).
var scrollToSection =
- !settings.lastRouteChangeWasPopstate() || oldRouteWasSection;
+ !settings.lastRouteChangeWasPopstate() || oldRouteWasSection ||
+ oldRoute == settings.Route.BASIC;
// For previously uncreated pages (including on first load), allow the page
// to render before scrolling to or expanding the section.
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/basic_page_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698