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

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

Issue 2297663008: MD Settings: Prevent unexpected scrolling to section on popstates. (Closed)
Patch Set: add test Created 4 years, 3 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 | « chrome/browser/resources/settings/route.js ('k') | chrome/test/data/webui/settings/route_tests.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 78bfe20f7512cb76e14f133ccba95ad8b8bd513a..6144263d8a4e798b5d3fac46325b97b1cfb94148 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -88,14 +88,14 @@ var MainPageBehaviorImpl = {
if (!currentRoute.isSubpage() || expandedSection != currentSection) {
promise = this.collapseSection_(expandedSection);
// Scroll to the collapsed section.
- if (currentSection)
+ if (currentSection && !settings.lastRouteChangeWasPopstate())
currentSection.scrollIntoView();
}
} else if (currentSection) {
// Expand the section into a subpage or scroll to it on the main page.
if (currentRoute.isSubpage())
promise = this.expandSection_(currentSection);
- else
+ else if (!settings.lastRouteChangeWasPopstate())
currentSection.scrollIntoView();
}
@@ -228,13 +228,7 @@ var MainPageBehaviorImpl = {
var newSection = settings.getCurrentRoute().section &&
this.getSection(settings.getCurrentRoute().section);
- // Scroll to the section if indicated by the route. TODO(michaelpg): Is
- // this the right behavior, or should we return to the previous scroll
- // position?
- if (newSection)
- newSection.scrollIntoView();
- else
- this.scroller.scrollTop = this.origScrollTop_;
+ this.scroller.scrollTop = this.origScrollTop_;
this.currentAnimation_ = section.animateCollapse(
/** @type {!HTMLElement} */(this.scroller));
« no previous file with comments | « chrome/browser/resources/settings/route.js ('k') | chrome/test/data/webui/settings/route_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698