Commit fe4a30b0 authored by dschuyler's avatar dschuyler Committed by Commit bot

[MD settings] scroll to sections from subpages

This CL allows for scrolling to a section from within a sub section.
It also rearranges the behavior logic a bit to make it easier to follow.

BUG=617737
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation;master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2130613002
Cr-Commit-Position: refs/heads/master@{#406661}
parent f5c98893
...@@ -394,18 +394,23 @@ var RoutableBehaviorImpl = { ...@@ -394,18 +394,23 @@ var RoutableBehaviorImpl = {
return; return;
} }
if (!newRouteIsSubpage && oldRouteIsSubpage) { if (newRouteIsSubpage) {
var section = this.getSection_(oldRoute.section); if (!oldRouteIsSubpage || newRoute.section != oldRoute.section) {
if (section) var section = this.getSection_(newRoute.section);
this.collapseSection(section); if (section)
} else if (newRouteIsSubpage && this.expandSection(section);
(!oldRouteIsSubpage || newRoute.section != oldRoute.section)) { }
var section = this.getSection_(newRoute.section); } else {
if (section) if (oldRouteIsSubpage) {
this.expandSection(section); var section = this.getSection_(oldRoute.section);
} else if (newRoute && newRoute.section && if (section)
this.$$('[data-page=' + newRoute.page + ']')) { this.collapseSection(section);
this.scrollToSection_(); }
if (newRoute && newRoute.section &&
this.$$('[data-page=' + newRoute.page + ']')) {
this.scrollToSection_();
}
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment