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 01aafedc26634652eea25cf0374a563b75ad123d..6cd088667f92dfe1c623efc5e869003d7b01e92e 100644 |
--- a/chrome/browser/resources/options/inline_editable_list.js |
+++ b/chrome/browser/resources/options/inline_editable_list.js |
@@ -142,7 +142,7 @@ cr.define('options', function() { |
if (focusElement) { |
window.setTimeout(function() { |
// Make sure we are still in edit mode by the time we execute. |
- if (self.editing) { |
+ if (self.editing && self.focusPlaceholder) { |
focusElement.focus(); |
focusElement.select(); |
} |
@@ -253,7 +253,8 @@ cr.define('options', function() { |
var list = self.parentNode; |
if (list && list.focusPlaceholder) { |
list.focusPlaceholder = false; |
- inputEl.focus(); |
+ if (list.shouldFocusPlaceholder()) |
+ inputEl.focus(); |
} |
}, 50); |
} |
@@ -407,6 +408,14 @@ cr.define('options', function() { |
leadItem.editing = false; |
} |
}, |
+ |
+ /** |
+ * May be overridden by subclasses to disable focusing the placeholder. |
+ * @return true if the placeholder element should be focused on edit commit. |
+ */ |
+ shouldFocusPlaceholder: function() { |
+ return true; |
+ }, |
}; |
// Export |