From fe2adeeee1c970b0a059aa3535bfbc7d8dc9d795 Mon Sep 17 00:00:00 2001 From: Catherine Kleimeier Date: Thu, 19 Oct 2017 18:57:40 -0400 Subject: [PATCH] hotkeys: Fix ESC removing message feed focus in Firefox. We correct a bug on Firefox where using the ESC key to close an edit box that was opened by the left arrow key caused the message feed to lose focus, making it difficult to navigate the message feed by keyboard afterwards. We fix this bug by changing the function that handles the ESC key during an edit to pass the correct object to the message_edit.end function. Fixes #7072. --- static/js/hotkey.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/js/hotkey.js b/static/js/hotkey.js index e86bc4dc72..3c537977a9 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -166,7 +166,12 @@ exports.process_escape_key = function (e) { } if (message_edit.is_editing(current_msg_list.selected_id())) { - message_edit.end(current_msg_list.selected_row()); + // Using this definition of "row" instead of "current_msg_list.selected_row()" + // because it returns a more complete object. + // Necessary for refocusing on message list in Firefox. + row = $(".message_edit_content").filter(":focus").closest(".message_row"); + row.find('.message_edit_content').blur(); + message_edit.end(row); return true; }