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

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

Issue 2552393002: MD Settings: Scroll correctly for navigations that exit search mode. (Closed)
Patch Set: update Created 4 years 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
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 904b12fa399d2a7536443a3ef7cdaacdff336c91..ce1581225272332145660dd1e31012a22fad65e4 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -9,6 +9,19 @@
* @polymerBehavior MainPageBehavior
*/
var MainPageBehaviorImpl = {
+ properties: {
+ /**
+ * Whether a search operation is in progress or previous search results are
+ * being displayed.
+ * @private {boolean}
+ */
+ inSearchMode: {
+ type: Boolean,
+ value: false,
+ observer: 'inSearchModeChanged_',
+ },
+ },
+
/** @type {?HTMLElement} The scrolling container. */
scroller: null,
@@ -48,6 +61,16 @@ var MainPageBehaviorImpl = {
},
/**
+ * When exiting search mode, we need to make another attempt to scroll to
+ * the correct section, since it has just been re-rendered.
+ * @private
+ */
+ inSearchModeChanged_: function(inSearchMode) {
+ if (!inSearchMode)
+ this.tryTransitionToSection_(!settings.lastRouteChangeWasPopstate());
+ },
+
+ /**
* If possible, transitions to the current route's section (by expanding or
* scrolling to it). If another transition is running, finishes or cancels
* that one, then schedules this function again. This ensures the current

Powered by Google App Engine
This is Rietveld 408576698