Commit 4c5e8604 authored by Patti's avatar Patti Committed by Commit Bot

Settings: Set active global scroll handler at the end of the execution queue.

Currently, the global scroll handler gets set as active immediately when the
chrome://settings route changes. However, scroll-handling elements such as
iron-list may require access to the global scroll handler during a route change.
Fix by setting the global scroll handler active value at the next event loop
instead of immediately.

Bug: 835712
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Ie02843a8d556a5b44a87f4ba696cab2eeff23e70
Reviewed-on: https://chromium-review.googlesource.com/1100659Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Patti <patricialor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572457}
parent 9071cf2d
...@@ -52,12 +52,26 @@ cr.define('settings', function() { ...@@ -52,12 +52,26 @@ cr.define('settings', function() {
/** @override */ /** @override */
attached: function() { attached: function() {
this.active_ = settings.getCurrentRoute() == this.subpageRoute;
scrollTargetResolver.promise.then(this._setScrollTarget.bind(this)); scrollTargetResolver.promise.then(this._setScrollTarget.bind(this));
}, },
/** @param {!settings.Route} route */ /** @param {!settings.Route} route */
currentRouteChanged: function(route) { currentRouteChanged: function(route) {
this.active_ = route == this.subpageRoute; // Immediately set the scroll target to active when this page is
// activated, but wait a task to remove the scroll target when the page is
// deactivated. This gives scroll handlers like iron-list a chance to
// handle scroll events that are fired as a result of the route changing.
// TODO(https://crbug.com/859794): Having this timeout can result some
// jumpy behaviour in the scroll handlers. |this.active_| can be set
// immediately when this bug is fixed.
if (route == this.subpageRoute) {
this.active_ = true;
} else {
setTimeout(() => {
this.active_ = false;
});
}
}, },
/** /**
......
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