Chromium Code Reviews| Index: chrome/browser/resources/settings/internet_page/internet_detail_page.js |
| diff --git a/chrome/browser/resources/settings/internet_page/internet_detail_page.js b/chrome/browser/resources/settings/internet_page/internet_detail_page.js |
| index ef74fd58e9a3f81d343047e79d349016b95633d8..4a6677f6cb427451df97d1e9dde27b8382bf3026 100644 |
| --- a/chrome/browser/resources/settings/internet_page/internet_detail_page.js |
| +++ b/chrome/browser/resources/settings/internet_page/internet_detail_page.js |
| @@ -144,6 +144,9 @@ Polymer({ |
| */ |
| networksChangedListener_: null, |
| + /** @private {boolean} */ |
| + didSetFocus_: false, |
| + |
| /** |
| * settings.RouteObserverBehavior |
| * @param {!settings.Route} route |
| @@ -180,10 +183,22 @@ Polymer({ |
| ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED, |
| Name: {Active: name}, |
| }; |
| + this.didSetFocus_ = false; |
| this.getNetworkDetails_(); |
| }, |
| /** @private */ |
| + maybeSetFocus_: function() { |
| + if (this.didSetFocus_) |
| + return; |
| + this.didSetFocus_ = true; |
| + var button = this.$$('#buttonDiv .primary-button:not([hidden])'); |
|
dpapad
2017/04/26 00:22:38
Nit (optional): You can also use a single selector
stevenjb
2017/04/26 17:53:36
Does that perform the first query and then the sec
dpapad
2017/04/26 18:14:49
Hm, I think it returns the 1st item that matches e
|
| + if (!button) |
| + button = this.$$('#buttonDiv .secondary-button:not([hidden])'); |
| + button.focus(); |
| + }, |
| + |
| + /** @private */ |
| close_: function() { |
| // Delay navigating until the next render frame to allow other subpages to |
| // load first. |
| @@ -285,6 +300,7 @@ Polymer({ |
| return; |
| } |
| this.networkProperties = properties; |
| + this.maybeSetFocus_(); |
|
dpapad
2017/04/26 00:22:38
I missed this file completely in previous iteratio
stevenjb
2017/04/26 17:53:36
1. Which buttons are visible may change after we s
|
| }, |
| /** |
| @@ -305,6 +321,7 @@ Polymer({ |
| Connectable: state.Connectable, |
| ConnectionState: state.ConnectionState, |
| }; |
| + this.maybeSetFocus_(); |
| }, |
| /** |
| @@ -549,7 +566,8 @@ Polymer({ |
| this.networkingPrivate.startActivate(this.guid); |
| }, |
| - /** @const {string} */ CR_EXPAND_BUTTON_TAG: 'CR-EXPAND-BUTTON', |
| + /** @const {string} */ |
| + CR_EXPAND_BUTTON_TAG: 'CR-EXPAND-BUTTON', |
| /** |
| * @param {Event} event |