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

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

Issue 7004058: Commit inline editable list changes when window loses focus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: handle blurs statically Created 9 years, 7 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
« no previous file with comments | « chrome/browser/resources/options/content_settings_exceptions_area.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1c94a8d200b0ddd512a895a21852ded314c8874d..c071ff863a0d47255dda3919e13bbbd0b0142b77 100644
--- a/chrome/browser/resources/options/inline_editable_list.js
+++ b/chrome/browser/resources/options/inline_editable_list.js
@@ -72,8 +72,8 @@ cr.define('options', function() {
DeletableItem.prototype.decorate.call(this);
this.editFields_ = [];
- this.addEventListener('mousedown', this.handleMouseDown_.bind(this));
- this.addEventListener('keydown', this.handleKeyDown_.bind(this));
+ this.addEventListener('mousedown', this.handleMouseDown_);
+ this.addEventListener('keydown', this.handleKeyDown_);
this.addEventListener('leadChange', this.handleLeadChange_);
},
@@ -328,6 +328,21 @@ cr.define('options', function() {
},
};
+ /**
+ * Takes care of committing changes to inline editable list items when the
+ * window loses focus.
+ */
+ function handleWindowBlurs() {
+ window.addEventListener('blur', function(e) {
+ var itemAncestor = findAncestor(document.activeElement, function(node) {
+ return node instanceof InlineEditableItem;
+ });
+ if (itemAncestor);
+ document.activeElement.blur();
+ });
+ }
+ handleWindowBlurs();
+
var InlineEditableItemList = cr.ui.define('list');
InlineEditableItemList.prototype = {
« no previous file with comments | « chrome/browser/resources/options/content_settings_exceptions_area.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698