hotkeys: Close clicked gear menu with ESC.

Fixes #4200.
This commit is contained in:
Joshua Pan
2017-05-21 19:28:52 -07:00
committed by Tim Abbott
parent c40759562c
commit c78b310381
2 changed files with 15 additions and 0 deletions

View File

@@ -51,6 +51,16 @@ exports.open = function () {
$("#gear-menu").find("li:not(.invisible) a").eq(0).focus();
};
exports.is_open = function () {
return $(".dropdown").hasClass("open");
};
exports.close = function () {
if (exports.is_open()) {
$(".dropdown").removeClass("open");
}
};
return exports;
}());

View File

@@ -172,6 +172,11 @@ exports.process_escape_key = function (e) {
return true;
}
if (gear_menu.is_open()) {
gear_menu.close();
return true;
}
if (exports.processing_text()) {
if ($(".message_edit_content").filter(":focus").length > 0) {
row = $(".message_edit_content").filter(":focus").closest(".message_row");