Index: chrome/browser/resources/options/inline_editable_list.js |
diff --git a/chrome/browser/resources/options/inline_editable_list.js b/chrome/browser/resources/options/inline_editable_list.js |
index b01d4a3bec50b359096799ff32813198c67960ff..b762a1d6d4a1d9b4c850d1b69ad66f59e648e21c 100644 |
--- a/chrome/browser/resources/options/inline_editable_list.js |
+++ b/chrome/browser/resources/options/inline_editable_list.js |
@@ -83,6 +83,18 @@ cr.define('options', function() { |
}, |
/** |
+ * Called when the input element receives focus. Selects this item in the |
+ * list selection model. |
+ * @private |
+ */ |
+ handleFocus_: function() { |
+ var list = this.parentNode; |
+ var index = list.getIndexOfListItem(this); |
+ list.selectionModel.selectedIndex = index; |
+ list.selectionModel.anchorIndex = index; |
+ }, |
+ |
+ /** |
* Called when this element gains or loses 'lead' status. Updates editing |
* mode accordingly. |
* @private |
@@ -231,6 +243,7 @@ cr.define('options', function() { |
inputEl.setAttribute('displaymode', 'edit'); |
inputEl.staticVersion = textEl; |
} |
+ inputEl.addEventListener('focus', this.handleFocus_.bind(this)); |
container.appendChild(inputEl); |
this.editFields_.push(inputEl); |