diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index f60e79d7a2..0baa37358a 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -214,6 +214,7 @@ exports.initialize = function () { return stream_data.subscribed_streams(); }, items: 3, + fixed: true, highlighter: function (item) { var query = this.query; return typeahead_helper.highlight_query_in_phrase(query, item); @@ -232,6 +233,7 @@ exports.initialize = function () { return exports.topics_seen_for(stream_name); }, items: 3, + fixed: true, highlighter: composebox_typeahead_highlighter, sorter: function (items) { var sorted = typeahead_helper.sorter(this.query, items, function (x){return x;}); @@ -246,6 +248,7 @@ exports.initialize = function () { source: page_params.people_list, items: 5, dropup: true, + fixed: true, highlighter: function (item) { var query = get_last_recipient_in_pm(this.query); var item_formatted = typeahead_helper.render_person(item); @@ -339,6 +342,7 @@ exports.initialize = function () { } }, dropup: true, + fixed: true, matcher: function (item) { if (this.completing === 'emoji') { return query_matches_emoji(this.token, item); diff --git a/static/js/search.js b/static/js/search.js index 38af0c84af..b5516ab65c 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -52,6 +52,7 @@ exports.initialize = function () { search_object = suggestions.lookup_table; return suggestions.strings; }, + fixed: true, items: 30, helpOnEmptyStrings: true, naturalSearch: true, diff --git a/static/third/bootstrap/js/bootstrap.js b/static/third/bootstrap/js/bootstrap.js index ae35855ef2..8370637921 100644 --- a/static/third/bootstrap/js/bootstrap.js +++ b/static/third/bootstrap/js/bootstrap.js @@ -1826,6 +1826,11 @@ this.source = this.options.source this.shown = false this.dropup = this.options.dropup + this.fixed = this.options.fixed || false; + + if (this.fixed) { + this.$menu.css('position', 'fixed'); + } // The naturalSearch option causes arrow keys to immediately // update the search box with the underlying values from the // search suggestions. @@ -1854,7 +1859,16 @@ } , show: function () { - var pos = $.extend({}, this.$element.offset(), { + var pos; + + if (this.fixed) { + // Relative to screen instead of to page + pos = this.$element[0].getBoundingClientRect(); + } else { + pos = this.$element.offset(); + } + + pos = $.extend({}, pos, { height: this.$element[0].offsetHeight })