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.

bootstrap_typeahead: Fix bug on select with no active item.

evykassirer6ff793590f52
diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.ts
index 264ea92230e..0a653d6e80b 100644
--- a/web/src/bootstrap_typeahead.ts
+++ b/web/src/bootstrap_typeahead.ts
@@ -322,7 +322,8 @@ export class Typeahead<ItemType extends string | object> {
}
select(e?: JQuery.ClickEvent | JQuery.KeyUpEvent | JQuery.KeyDownEvent): this {
- const val = this.values.get(the(this.$menu.find(".active")));
+ const active_option = this.$menu.find(".active")[0];
+ const val = active_option ? this.values.get(active_option) : undefined;
// It's possible that we got here from pressing enter with nothing highlighted.
if (!this.requireHighlight && val === undefined) {
return this.hide();