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

Unified Diff: chrome/browser/resources/options/inline_editable_list.js

Issue 7607027: Options: Two fixes for Autofill lists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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: 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

Powered by Google App Engine
This is Rietveld 408576698