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..0a51d83336990ac5f7781c0685a69da3d21b623e 100644 |
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js |
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js |
@@ -101,9 +101,6 @@ var MainPageBehaviorImpl = { |
// If the section shouldn't be expanded, collapse it. |
if (!currentRoute.isSubpage() || expandedSection != currentSection) { |
promise = this.collapseSection_(expandedSection); |
- // Scroll to the collapsed section. |
- if (currentSection && scrollToSection) |
- currentSection.scrollIntoView(); |
} else { |
// Scroll to top while sliding to another subpage. |
this.scroller.scrollTop = 0; |
@@ -253,7 +250,11 @@ var MainPageBehaviorImpl = { |
var newSection = settings.getCurrentRoute().section && |
this.getSection(settings.getCurrentRoute().section); |
- this.scroller.scrollTop = this.origScrollTop_; |
+ // Scroll to the new section or the original position. |
+ if (newSection && !settings.lastRouteChangeWasPopstate()) |
+ newSection.scrollIntoView(); |
+ else |
+ this.scroller.scrollTop = this.origScrollTop_; |
this.currentAnimation_ = section.animateCollapse( |
/** @type {!HTMLElement} */(this.scroller)); |