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.
This commit is contained in:
Catherine Kleimeier
2017-10-19 18:57:40 -04:00
committed by Tim Abbott
parent 0d1194811f
commit fe2adeeee1

View File

@@ -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;
}