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

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

Issue 2776763002: MD Settings: Fix scroll when navigating from subpage to About and back. (Closed)
Patch Set: Created 3 years, 9 months 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 | no next file » | 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 268f2af25fbcb40373d0105c89ce11871ba7b40b..56a74cd96cb0047f12135631c2edd43fc828ab8b 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -67,13 +67,18 @@ var MainPageBehaviorImpl = {
!!oldRoute && !!oldRoute.parent && !!oldRoute.section &&
oldRoute.parent.section != oldRoute.section;
- // Always scroll to the top if navigating from a section to the root route
- // or when navigating to the About page.
- if (this.scroller &&
- ((oldRouteWasSection && newRoute == settings.Route.BASIC) ||
- newRoute == settings.Route.ABOUT)) {
- this.scroller.scrollTop = 0;
- return;
+ if (this.scroller) {
+ // When navigating from a section to the root route, we just need to
+ // scroll to the top, and can early exit afterwards.
+ if (oldRouteWasSection && newRoute == settings.Route.BASIC) {
+ this.scroller.scrollTop = 0;
+ return;
+ }
+
+ // When navigating to the About page, we need to scroll to the top, and
+ // still do the rest of section management.
+ if (newRoute == settings.Route.ABOUT)
+ this.scroller.scrollTop = 0;
}
// Scroll to the section except for back/forward. Also scroll for any
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698