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.

third: Prevent typeahead from going off top of screen.

Tim Abbott98b5f01d14e1
diff --git a/static/third/bootstrap-typeahead/typeahead.js b/static/third/bootstrap-typeahead/typeahead.js
index 86eae60aa3f..2953ce68187 100644
--- a/static/third/bootstrap-typeahead/typeahead.js
+++ b/static/third/bootstrap-typeahead/typeahead.js
@@ -69,6 +69,11 @@
* so that the `Backspace` key is free to interact with the other elements.
*
* Our custom changes include all mentions of `helpOnEmptyStrings` and `hideOnEmpty`.
+ *
+ * 6. Prevent typeahead going off top of screen:
+ * If typeahead would go off the top of the screen, we set its top to 0 instead.
+ * This patch should be replaced with something more flexible.
+ *
* ============================================================ */
!function($){
@@ -174,6 +179,11 @@
top_pos = pos.top - this.$container.outerHeight()
}
+ // Zulip patch: Avoid typeahead going off top of screen.
+ if (top_pos < 0) {
+ top_pos = 0;
+ }
+
this.$container.css({
top: top_pos
, left: pos.left