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.

typeaheads: Hide typeahead if selected item loses focus.

apoorvapendseee273b4df96a
diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.ts
index ecb56c500ac..73904ba86f8 100644
--- a/web/src/bootstrap_typeahead.ts
+++ b/web/src/bootstrap_typeahead.ts
@@ -650,7 +650,13 @@ export class Typeahead<ItemType extends string | object> {
this.$menu
.on("click", "li", this.click.bind(this))
.on("mouseenter", "li", this.mouseenter.bind(this))
- .on("mousemove", "li", this.mousemove.bind(this));
+ .on("mousemove", "li", this.mousemove.bind(this))
+ .on("blur", "li", (e) => {
+ // Selecting typeahead item content followed by blur
+ // should hide the typeahead if the relatedTarget is
+ // outside the typeahead.
+ this.blur(e);
+ });
$(window).on("resize", this.resizeHandler.bind(this));
}