mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
hotkeys: Clean up dispatching of drafts hotkeys.
We now explicitly return true from process_hotkey() when we handle up/down/backspace for the drafts modal. Also, we no longer call preventDefault() from drafts.draft_handle_events(), since the caller does that, and we no longer return `true`, since we were never inspecting the return value anyway.
This commit is contained in:
@@ -260,10 +260,9 @@ exports.drafts_handle_events = function (e, event_key) {
|
||||
// 55 is the minimum distance from the top that will require extra scrolling.
|
||||
$(".drafts-list")[0].scrollTop = $(".drafts-list")[0].scrollTop - (55 - prev_focus_draft_row.position().top);
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// This detects down arrow key presses when the draft overlay
|
||||
// is open and scrolls through the drafts.
|
||||
if (event_key === "down_arrow") {
|
||||
@@ -292,10 +291,9 @@ exports.drafts_handle_events = function (e, event_key) {
|
||||
$(".drafts-list")[0].scrollTop = $(".drafts-list")[0].scrollTop + 2 - (dist_from_bottom);
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allows user to delete drafts with backspace
|
||||
if (event_key === "backspace") {
|
||||
var elt = document.activeElement;
|
||||
@@ -319,8 +317,6 @@ exports.drafts_handle_events = function (e, event_key) {
|
||||
if ($("#drafts_table .draft-row").length === 0) {
|
||||
$('#drafts_table .no-drafts').show();
|
||||
}
|
||||
e.preventDefault();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user