Commit 16e04763 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

Internet detail dialog: Focus the action button on load.

This is modeled after the same functionality in the internet detail
page implementation.

R=stevenjb@chromium.org

Bug: 999474
Test: none
Change-Id: If5dcac633d5881aa04878b0e57223a437c9af4bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1793808
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695049}
parent 625f209e
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
</style> </style>
<!-- Title section: Icon + name + connection state. --> <!-- Title section: Icon + name + connection state. -->
<div class="section first"> <div id="title" class="section first">
<div class="start layout horizontal center"> <div class="start layout horizontal center">
<cr-network-icon <cr-network-icon
show-technology-badge="[[showTechnologyBadge_]]" show-technology-badge="[[showTechnologyBadge_]]"
......
...@@ -24,7 +24,10 @@ Polymer({ ...@@ -24,7 +24,10 @@ Polymer({
guid: String, guid: String,
/** @private {!chromeos.networkConfig.mojom.ManagedProperties|undefined} */ /** @private {!chromeos.networkConfig.mojom.ManagedProperties|undefined} */
managedProperties_: Object, managedProperties_: {
type: Object,
observer: 'managedPropertiesChanged_',
},
/** @private {?OncMojo.DeviceStateProperties} */ /** @private {?OncMojo.DeviceStateProperties} */
deviceState_: { deviceState_: {
...@@ -54,6 +57,12 @@ Polymer({ ...@@ -54,6 +57,12 @@ Polymer({
}, },
}, },
/**
* Set to true once the action button has been focused.
* @private {boolean}
*/
didSetFocus_: false,
/** /**
* Set to true to once the initial properties have been received. This * Set to true to once the initial properties have been received. This
* prevents setProperties from being called when setting default properties. * prevents setProperties from being called when setting default properties.
...@@ -134,6 +143,21 @@ Polymer({ ...@@ -134,6 +143,21 @@ Polymer({
}; };
}, },
/** @private */
managedPropertiesChanged_: function() {
assert(this.managedProperties_);
// Focus the action button once the initial state is set.
if (!this.didSetFocus_ &&
this.showConnectDisconnect_(this.managedProperties_)) {
const button = this.$$('#title .action-button:not([hidden])');
if (button) {
button.focus();
this.didSetFocus_ = true;
}
}
},
/** @private */ /** @private */
close_: function() { close_: function() {
chrome.send('dialogClose'); chrome.send('dialogClose');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment