From 73d0b8477955fc2e1cf793a16dc742d2898d620d Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Wed, 28 Oct 2015 14:01:21 +0100 Subject: [PATCH] allow to hide modal on ESC --- app/assets/javascripts/app/lib/bootstrap/modal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/lib/bootstrap/modal.js b/app/assets/javascripts/app/lib/bootstrap/modal.js index 1a23324c2..6a6468667 100644 --- a/app/assets/javascripts/app/lib/bootstrap/modal.js +++ b/app/assets/javascripts/app/lib/bootstrap/modal.js @@ -147,11 +147,11 @@ Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { - this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { + $(window).on('keydown.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isShown) { - this.$element.off('keydown.dismiss.bs.modal') + $(window).off('keydown.dismiss.bs.modal') } }