Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_shared_menu/cr_shared_menu.js |
| diff --git a/ui/webui/resources/cr_elements/cr_shared_menu/cr_shared_menu.js b/ui/webui/resources/cr_elements/cr_shared_menu/cr_shared_menu.js |
| index e08fd0d10d43d197a45af4e9ad8909037107e120..7dfdd31faec7d90d477a53a60744874007deaca1 100644 |
| --- a/ui/webui/resources/cr_elements/cr_shared_menu/cr_shared_menu.js |
| +++ b/ui/webui/resources/cr_elements/cr_shared_menu/cr_shared_menu.js |
| @@ -113,14 +113,6 @@ Polymer({ |
| /** @override */ |
| attached: function() { |
| window.addEventListener('resize', this.closeMenu.bind(this)); |
| - |
| - var focusableChildren = Polymer.dom(this).querySelectorAll( |
| - '[tabindex],button'); |
| - if (focusableChildren.length > 0) { |
| - this.$.dropdown.focusTarget = focusableChildren[0]; |
| - this.firstFocus_ = focusableChildren[0]; |
| - this.lastFocus_ = focusableChildren[focusableChildren.length - 1]; |
| - } |
| }, |
| /** Closes the menu. */ |
| @@ -143,6 +135,14 @@ Polymer({ |
| this.itemData = itemData; |
| this.lastAnchor_ = anchor; |
| + var focusableChildren = Polymer.dom(this).querySelectorAll( |
| + '[tabindex]:not([hidden]),button:not([hidden])'); |
|
Dan Beam
2016/07/14 17:09:20
and it starts growing
tsergeant
2016/07/15 01:17:48
https://www.youtube.com/watch?v=bWcASV2sey0
https
|
| + if (focusableChildren.length > 0) { |
| + this.$.dropdown.focusTarget = focusableChildren[0]; |
| + this.firstFocus_ = focusableChildren[0]; |
| + this.lastFocus_ = focusableChildren[focusableChildren.length - 1]; |
| + } |
| + |
| // Move the menu to the anchor. |
| this.$.dropdown.positionTarget = anchor; |
| this.menuOpen = true; |