mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
drafts-ui: Fix pressing "Enter" when there are no drafts.
This commit fixes an assertion error on pressing "Enter" in drafts UI when there are no drafts.
This commit is contained in:
@@ -169,6 +169,12 @@ const keyboard_handling_context: messages_overlay_ui.Context = {
|
||||
// This handles when pressing Enter while looking at drafts.
|
||||
// It restores draft that is focused.
|
||||
const draft_id_arrow = this.get_items_ids();
|
||||
|
||||
if (draft_id_arrow.length === 0) {
|
||||
// Do nothing if there are no drafts.
|
||||
return;
|
||||
}
|
||||
|
||||
const focused_draft_id = messages_overlay_ui.get_focused_element_id(this);
|
||||
if (focused_draft_id !== undefined) {
|
||||
restore_draft(focused_draft_id);
|
||||
|
Reference in New Issue
Block a user