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: Update / hide typeahead menu on clicking outside.

N-Shar-maecf557eab929
diff --git a/static/third/bootstrap-typeahead/typeahead.js b/static/third/bootstrap-typeahead/typeahead.js
index 0b0daf5458f..de451c4ff3e 100644
--- a/static/third/bootstrap-typeahead/typeahead.js
+++ b/static/third/bootstrap-typeahead/typeahead.js
@@ -322,6 +322,7 @@
.on('blur', this.blur.bind(this))
.on('keypress', this.keypress.bind(this))
.on('keyup', this.keyup.bind(this))
+ .on('click', this.element_click.bind(this))
if (this.eventSupported('keydown')) {
this.$element.on('keydown', this.keydown.bind(this))
@@ -447,6 +448,12 @@
}, 150)
}
+ , element_click: function (e) {
+ // update / hide the typeahead menu if the user clicks anywhere
+ // inside the typing area, to avoid misplaced typeahead insertion.
+ this.lookup()
+ }
+
, click: function (e) {
e.stopPropagation()
e.preventDefault()