diff --git a/background.html b/background.html
index ba247fe97c59..426f1701aa8a 100644
--- a/background.html
+++ b/background.html
@@ -166,8 +166,8 @@
{{ message }}
-
-
+
+
diff --git a/js/views/confirmation_dialog_view.js b/js/views/confirmation_dialog_view.js
index a7709a2ac837..a5b35bee4f24 100644
--- a/js/views/confirmation_dialog_view.js
+++ b/js/views/confirmation_dialog_view.js
@@ -20,8 +20,9 @@
this.render();
},
events: {
- 'click .ok': 'ok',
- 'click .cancel': 'cancel',
+ 'keyup': 'onKeyup',
+ 'click .ok': 'ok',
+ 'click .cancel': 'cancel',
},
render_attributes: function() {
return {
@@ -31,12 +32,21 @@
};
},
ok: function() {
- this.remove();
- this.resolve();
+ this.remove();
+ this.resolve();
},
cancel: function() {
- this.remove();
- this.reject();
+ this.remove();
+ this.reject();
+ },
+ onKeyup: function(event) {
+ console.log('ConfirmationDialogView onKeyup', event);
+ if (event.key === 'Escape' || event.key === 'Esc') {
+ this.cancel();
+ }
+ },
+ focusCancel: function() {
+ this.$('.cancel').focus();
}
});
})();
diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js
index 9edbba3f9a97..792887c020f9 100644
--- a/js/views/conversation_view.js
+++ b/js/views/conversation_view.js
@@ -689,10 +689,12 @@
this.checkUnverifiedSendMessage(e, {force: true});
}.bind(this),
reject: function() {
- // do nothing
- }
+ this.focusMessageField();
+ }.bind(this)
});
+
this.$el.prepend(dialog.el);
+ dialog.focusCancel();
},
checkUnverifiedSendMessage: function(e, options) {
@@ -750,6 +752,8 @@
var message = this.replace_colons(input.val()).trim();
var convo = this.model;
+ this.focusMessageField();
+
if (message.length > 0 || this.fileInput.hasFiles()) {
this.fileInput.getFiles().then(function(attachments) {
convo.sendMessage(message, attachments);