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

Side by Side Diff: chrome/browser/resources/settings/settings_page/settings_animated_pages.js

Issue 2813033004: MD Settings: Restore focus after exiting Content settings sub-subpages. (Closed)
Patch Set: Address comments. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-animated-pages' is a container for a page and animated subpages. 7 * 'settings-animated-pages' is a container for a page and animated subpages.
8 * It provides a set of common behaviors and animations. 8 * It provides a set of common behaviors and animations.
9 * 9 *
10 * Example: 10 * Example:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Observe the light DOM so we know when it's ready. 49 // Observe the light DOM so we know when it's ready.
50 this.lightDomObserver_ = Polymer.dom(this).observeNodes( 50 this.lightDomObserver_ = Polymer.dom(this).observeNodes(
51 this.lightDomChanged_.bind(this)); 51 this.lightDomChanged_.bind(this));
52 }, 52 },
53 53
54 /** 54 /**
55 * @param {!Event} e 55 * @param {!Event} e
56 * @private 56 * @private
57 */ 57 */
58 onIronSelect_: function(e) { 58 onIronSelect_: function(e) {
59 if (!this.focusConfig || !this.previousRoute_ || 59 if (!this.focusConfig || !this.previousRoute_)
60 e.detail.item.tagName != 'NEON-ANIMATABLE') { 60 return;
61
62 // Only handle iron-select events from neon-animatable elements and the
63 // SITE_SETTINGS subpage only.
64 if (!e.detail.item.matches(
65 'neon-animatable, settings-subpage#site-settings')) {
61 return; 66 return;
62 } 67 }
63 68
64 var selector = this.focusConfig.get(this.previousRoute_.path); 69 var selector = this.focusConfig.get(this.previousRoute_.path);
65 if (selector) { 70 if (selector) {
66 // neon-animatable has "display: none" until the animation finishes, so 71 // neon-animatable has "display: none" until the animation finishes, so
67 // calling focus() on any of its children has no effect until 72 // calling focus() on any of its children has no effect until
68 // "display: none" is removed. Therefore can't call focus() from within 73 // "display: none" is removed. Therefore can't call focus() from within
69 // the currentRouteChanged callback. Using 'iron-select' listener which 74 // the currentRouteChanged callback. Using 'iron-select' listener which
70 // fires after the animation has finished allows focus() to work as 75 // fires after the animation has finished allows focus() to work as
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // instance, such that the stamped instance will also be ignored by the 186 // instance, such that the stamped instance will also be ignored by the
182 // searching algorithm. 187 // searching algorithm.
183 if (template.hasAttribute('no-search')) 188 if (template.hasAttribute('no-search'))
184 subpage.setAttribute('no-search', ''); 189 subpage.setAttribute('no-search', '');
185 190
186 // Render synchronously so neon-animated-pages can select the subpage. 191 // Render synchronously so neon-animated-pages can select the subpage.
187 template.if = true; 192 template.if = true;
188 template.render(); 193 template.render();
189 }, 194 },
190 }); 195 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698