Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

dropdown_list_widget: Select first option on pressing enter in search.

Sahil Batra35433c02b300
diff --git a/web/src/dropdown_list_widget.js b/web/src/dropdown_list_widget.js
index 34a0b3e4078..7c524cb737f 100644
--- a/web/src/dropdown_list_widget.js
+++ b/web/src/dropdown_list_widget.js
@@ -201,6 +201,14 @@ export class DropdownListWidget {
break;
}
}
+
+ if (keydown_util.is_enter_event(e) && e.target === $search_input[0]) {
+ e.stopPropagation();
+ e.preventDefault();
+ // Select the first option from the menu on pressing
+ // "Enter" when focus is on the search input.
+ dropdown_elements().first().trigger("click");
+ }
});
}
@@ -525,6 +533,14 @@ export class MultiSelectDropdownListWidget extends DropdownListWidget {
break;
}
}
+
+ if (keydown_util.is_enter_event(e) && e.target === $search_input[0]) {
+ e.stopPropagation();
+ e.preventDefault();
+ // Select the first option from the menu on pressing
+ // "Enter" when focus is on the search input.
+ dropdown_elements().first().trigger("click");
+ }
});
}