diff --git a/static/js/hotkey.js b/static/js/hotkey.js index 0f39742990..855916174f 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -160,6 +160,10 @@ exports.is_editing_stream_name = function (e) { return $(e.target).is(".editable-section"); }; +exports.is_modal_open = function () { + return $(".modal").hasClass("in"); +}; + // Returns true if we handled it, false if the browser should. exports.process_escape_key = function (e) { var row; @@ -168,6 +172,11 @@ exports.process_escape_key = function (e) { return false; } + if (exports.is_modal_open()) { + $(".modal").modal("hide").attr("aria-hidden", false); + return true; + } + if (overlays.is_active()) { overlays.close_active(); return true;