| OLD | NEW |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 return; | 60 return; |
| 61 | 61 |
| 62 // Don't attempt to focus any anchor element, unless last navigation was a |
| 63 // 'pop' (backwards) navigation. |
| 64 if (!settings.lastRouteChangeWasPopstate()) |
| 65 return; |
| 66 |
| 62 // Only handle iron-select events from neon-animatable elements and the | 67 // Only handle iron-select events from neon-animatable elements and the |
| 63 // SITE_SETTINGS subpage only. | 68 // given whitelist of settings-subpage instances. |
| 64 if (!e.detail.item.matches( | 69 if (!e.detail.item.matches( |
| 65 'neon-animatable, settings-subpage#site-settings')) { | 70 'neon-animatable, ' + |
| 71 'settings-subpage#site-settings, ' + |
| 72 'settings-subpage[route-path=\"' + |
| 73 settings.Route.SITE_SETTINGS_COOKIES.path + '\"]')) { |
| 66 return; | 74 return; |
| 67 } | 75 } |
| 68 | 76 |
| 69 var selector = this.focusConfig.get(this.previousRoute_.path); | 77 var selector = this.focusConfig.get(this.previousRoute_.path); |
| 70 if (selector) { | 78 if (selector) { |
| 71 // neon-animatable has "display: none" until the animation finishes, so | 79 // neon-animatable has "display: none" until the animation finishes, so |
| 72 // calling focus() on any of its children has no effect until | 80 // calling focus() on any of its children has no effect until |
| 73 // "display: none" is removed. Therefore can't call focus() from within | 81 // "display: none" is removed. Therefore can't call focus() from within |
| 74 // the currentRouteChanged callback. Using 'iron-select' listener which | 82 // the currentRouteChanged callback. Using 'iron-select' listener which |
| 75 // fires after the animation has finished allows focus() to work as | 83 // fires after the animation has finished allows focus() to work as |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // instance, such that the stamped instance will also be ignored by the | 194 // instance, such that the stamped instance will also be ignored by the |
| 187 // searching algorithm. | 195 // searching algorithm. |
| 188 if (template.hasAttribute('no-search')) | 196 if (template.hasAttribute('no-search')) |
| 189 subpage.setAttribute('no-search', ''); | 197 subpage.setAttribute('no-search', ''); |
| 190 | 198 |
| 191 // Render synchronously so neon-animated-pages can select the subpage. | 199 // Render synchronously so neon-animated-pages can select the subpage. |
| 192 template.if = true; | 200 template.if = true; |
| 193 template.render(); | 201 template.render(); |
| 194 }, | 202 }, |
| 195 }); | 203 }); |
| OLD | NEW |