| Index: ui/webui/resources/cr_elements/network/cr_network_list.js
|
| diff --git a/ui/webui/resources/cr_elements/network/cr_network_list.js b/ui/webui/resources/cr_elements/network/cr_network_list.js
|
| index 82b5fc70658c3bfd4b8553983412ad5cf1e593cf..54588416fee54bd71bf5d1f3734532f10b6f7d5a 100644
|
| --- a/ui/webui/resources/cr_elements/network/cr_network_list.js
|
| +++ b/ui/webui/resources/cr_elements/network/cr_network_list.js
|
| @@ -67,12 +67,46 @@ Polymer({
|
|
|
| observers: ['updateListItems_(networks, customItems)'],
|
|
|
| + /**
|
| + * True if element is focused, but dom-repeat is not rendered yet.
|
| + * @private
|
| + */
|
| + needFocus_: false,
|
| +
|
| + attached: function() {
|
| + var self = this;
|
| + var observer = new MutationObserver(function() {
|
| + self.checkFocus_();
|
| + });
|
| + observer.observe(this.$.networkList, { childList: true });
|
| + },
|
| +
|
| + focus: function() {
|
| + this.needFocus_ = false;
|
| + var items = this.$.networkList.getElementsByTagName('cr-network-list-item');
|
| + if (items && items[0]) {
|
| + items[0].focus();
|
| + } else {
|
| + this.needFocus_ = true;
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * Triggers delayed focus.
|
| + * @private
|
| + */
|
| + checkFocus_: function() {
|
| + if (this.needFocus_)
|
| + this.focus();
|
| + },
|
| +
|
| /** @private */
|
| updateListItems_: function() {
|
| this.saveScroll(this.$.networkList);
|
| this.listItems_ = this.networks.concat(this.customItems);
|
| this.restoreScroll(this.$.networkList);
|
| this.updateScrollableContents();
|
| + this.checkFocus_();
|
| },
|
|
|
| /**
|
|
|