diff --git a/app/assets/javascripts/discourse/views/user-card.js.es6 b/app/assets/javascripts/discourse/views/user-card.js.es6 index 714f936fac5..2e01858f4b5 100644 --- a/app/assets/javascripts/discourse/views/user-card.js.es6 +++ b/app/assets/javascripts/discourse/views/user-card.js.es6 @@ -120,6 +120,14 @@ export default Discourse.View.extend(CleansUp, { this.get('controller').close(); }, + keyUp(e) { + if (e.keyCode === 27) { // ESC + const target = this.get('controller.cardTarget'); + this.cleanUp(); + target.focus(); + } + }, + _removeEvents: function() { $('html').off(clickOutsideEventName);