Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: ui/webui/resources/cr_elements/network/cr_network_list.js

Issue 2708253002: MD OOBE: Focus network list when shown (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..64e3a13cea29a6532f91cc77ed10f22077b04eef 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,35 @@ Polymer({
observers: ['updateListItems_(networks, customItems)'],
+ /** @private {boolean} */
+ focusRequested_: false,
+
+ focus: function() {
+ this.focusRequested_ = true;
+ this.focusFirstItem_();
+ },
+
/** @private */
updateListItems_: function() {
this.saveScroll(this.$.networkList);
this.listItems_ = this.networks.concat(this.customItems);
this.restoreScroll(this.$.networkList);
this.updateScrollableContents();
+ if (this.focusRequested_) {
+ this.async(function() {
+ this.focusFirstItem_();
+ });
+ }
+ },
+
+ /** @private */
+ focusFirstItem_: function() {
+ // Select the first cr-network-list-item if there is one.
+ var item = this.$$('cr-network-list-item');
+ if (!item)
+ return;
+ item.focus();
+ this.focusRequested_ = false;
},
/**
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe_welcome.js ('k') | ui/webui/resources/cr_elements/network/cr_network_select.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698