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

Unified Diff: ui/webui/resources/js/cr/ui/focus_grid.js

Issue 2618633002: [MD History] Make first URL on Synced Device page instead of menu button. (Closed)
Patch Set: fix_closure Created 3 years, 11 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/js/cr/ui/focus_grid.js
diff --git a/ui/webui/resources/js/cr/ui/focus_grid.js b/ui/webui/resources/js/cr/ui/focus_grid.js
index 40c782e037b3139b6df3dfd7da4b62093373bb37..000fb051966f5438fe1bdd2eb3ed3347fa3fdae3 100644
--- a/ui/webui/resources/js/cr/ui/focus_grid.js
+++ b/ui/webui/resources/js/cr/ui/focus_grid.js
@@ -146,8 +146,11 @@ cr.define('cr.ui', function() {
/**
* Makes sure that at least one row is active. Should be called once, after
* adding all rows to FocusGrid.
+ * @param {number=} preferredRow The row to select if no other row is
+ * active. Selects the first item if this is beyond the range of the
+ * grid.
*/
- ensureRowActive: function() {
+ ensureRowActive: function(preferredRow) {
if (this.rows.length == 0)
return;
@@ -156,7 +159,7 @@ cr.define('cr.ui', function() {
return;
}
- this.rows[0].makeActive(true);
+ (this.rows[preferredRow || 0] || this.rows[0]).makeActive(true);
},
};

Powered by Google App Engine
This is Rietveld 408576698