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.

typeahead: Prevent select on click + drag.

apoorvapendse6600ca07350a
diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.ts
index 4072cbf74f2..ecb56c500ac 100644
--- a/web/src/bootstrap_typeahead.ts
+++ b/web/src/bootstrap_typeahead.ts
@@ -164,6 +164,7 @@ import {insertTextIntoField} from "text-field-edit";
import getCaretCoordinates from "textarea-caret";
import * as tippy from "tippy.js";
+import * as mouse_drag from "./mouse_drag.ts";
import * as scroll_util from "./scroll_util.ts";
import {get_string_diff, the} from "./util.ts";
@@ -321,6 +322,9 @@ export class Typeahead<ItemType extends string | object> {
}
select(e?: JQuery.ClickEvent | JQuery.KeyUpEvent | JQuery.KeyDownEvent): this {
+ if (e?.type === "click" && mouse_drag.is_drag(e)) {
+ return this;
+ }
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.