Blur buttons within a comment thread after they are pressed

This allows the user to still go back and forth with keyboard
shortcuts (otherwise the button eats them).

Bug: Issue 3854
Change-Id: I61c83a3278365a6cc8f1f766af8cb80b59006118
This commit is contained in:
Andrew Bonventre
2016-01-28 16:08:06 -05:00
parent 349380e121
commit c899ec1f53

View File

@@ -290,28 +290,28 @@ limitations under the License.
},
_handleReply: function(e) {
e.preventDefault();
this._preventDefaultAndBlur(e);
this.fire('reply', {comment: this.comment}, {bubbles: false});
},
_handleDone: function(e) {
e.preventDefault();
this._preventDefaultAndBlur(e);
this.fire('done', {comment: this.comment}, {bubbles: false});
},
_handleEdit: function(e) {
e.preventDefault();
this._preventDefaultAndBlur(e);
this._editDraft = this.comment.message;
this.editing = true;
},
_handleSave: function(e) {
e.preventDefault();
this._preventDefaultAndBlur(e);
this.save();
},
_handleCancel: function(e) {
e.preventDefault();
this._preventDefaultAndBlur(e);
if (this.comment.message == null || this.comment.message.length == 0) {
this.fire('discard', null, {bubbles: false});
return;
@@ -321,7 +321,7 @@ limitations under the License.
},
_handleDiscard: function(e) {
e.preventDefault();
this._preventDefaultAndBlur(e);
if (!this.comment.__draft) {
throw Error('Cannot discard a non-draft comment.');
}
@@ -340,6 +340,11 @@ limitations under the License.
}.bind(this));
},
_preventDefaultAndBlur: function(e) {
e.preventDefault();
Polymer.dom(e).rootTarget.blur();
},
_send: function(method, url) {
var xhr = document.createElement('gr-request');
var opts = {