Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
bootstrap_typeahead: Remove fixed argument.
Aman Agrawal689489573acd
diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.tsindex 0e4b823cdd4..272371a33f0 100644--- a/web/src/bootstrap_typeahead.ts+++ b/web/src/bootstrap_typeahead.ts@@ -209,7 +209,6 @@ export class Typeahead<ItemType extends string | object> {$header: JQuery;source: (query: string, input_element: TypeaheadInputElement) => ItemType[];dropup: boolean;- fixed: boolean;automated: () => boolean;trigger_selection: (event: JQuery.KeyDownEvent) => boolean;on_escape?: () => void;@@ -248,7 +247,6 @@ export class Typeahead<ItemType extends string | object> {this.$header = $(HEADER_ELEMENT_HTML).appendTo(this.$container);this.source = options.source;this.dropup = options.dropup ?? false;- this.fixed = options.fixed ?? false;this.automated = options.automated ?? (() => false);this.trigger_selection = options.trigger_selection ?? (() => false);this.on_escape = options.on_escape;@@ -266,9 +264,6 @@ export class Typeahead<ItemType extends string | object> {this.parentElement = options.parentElement;this.values = new WeakMap();- if (this.fixed) {- this.$container.css("position", "fixed");- }// The naturalSearch option causes arrow keys to immediately// update the search box with the underlying values from the// search suggestions.@@ -329,12 +324,7 @@ export class Typeahead<ItemType extends string | object> {if (this.parentElement === undefined) {let pos;- if (this.fixed) {- // Relative to screen instead of to page- pos = this.input_element.$element[0].getBoundingClientRect();- } else {- pos = this.input_element.$element.offset();- }+ pos = this.input_element.$element[0].getBoundingClientRect();pos = $.extend({}, pos, {height: this.input_element.$element[0].offsetHeight,@@ -709,7 +699,6 @@ type TypeaheadOptions<ItemType> = {automated?: () => boolean;closeInputFieldOnHide?: () => void;dropup?: boolean;- fixed?: boolean;header_html?: () => string | false;helpOnEmptyStrings?: boolean;matcher?: (item: ItemType, query: string) => boolean;diff --git a/web/src/composebox_typeahead.js b/web/src/composebox_typeahead.jsindex fb6f4d6605b..c554c5884b7 100644--- a/web/src/composebox_typeahead.js+++ b/web/src/composebox_typeahead.js@@ -1109,7 +1109,6 @@ export function initialize_topic_edit_typeahead(form_field, stream_name, dropup)type: "input",};return new Typeahead(bootstrap_typeahead_input, {- fixed: true,dropup,highlighter_html(item) {return typeahead_helper.render_typeahead_item({primary: item});@@ -1161,7 +1160,6 @@ export function initialize_compose_typeahead(selector) {new Typeahead(bootstrap_typeahead_input, {items: max_num_items,dropup: true,- fixed: true,// Performance note: We have trivial matcher/sorters to do// matching and sorting inside the `source` field to avoid// O(n) behavior in the number of users in the organization@@ -1196,7 +1194,6 @@ export function initialize({on_enter_send}) {return topics_seen_for(compose_state.stream_id());},items: 3,- fixed: true,highlighter_html(item) {return typeahead_helper.render_typeahead_item({primary: item});},@@ -1224,7 +1221,6 @@ export function initialize({on_enter_send}) {source: get_pm_people,items: max_num_items,dropup: true,- fixed: true,highlighter_html(item) {return typeahead_helper.render_person_or_user_group(item);},diff --git a/web/src/custom_profile_fields_ui.js b/web/src/custom_profile_fields_ui.jsindex 3f659524017..8d858d65404 100644--- a/web/src/custom_profile_fields_ui.js+++ b/web/src/custom_profile_fields_ui.js@@ -172,7 +172,6 @@ export function initialize_custom_pronouns_type_fields(element_id) {};new Typeahead(bootstrap_typeahead_input, {items: 3,- fixed: true,helpOnEmptyStrings: true,source() {return commonly_used_pronouns;diff --git a/web/src/pill_typeahead.ts b/web/src/pill_typeahead.tsindex b69dc92ff3a..57aa9a267b3 100644--- a/web/src/pill_typeahead.ts+++ b/web/src/pill_typeahead.ts@@ -55,7 +55,6 @@ export function set_up(};new Typeahead(bootstrap_typeahead_input, {items: 5,- fixed: true,dropup: true,source(query: string): TypeaheadItem[] {let source: TypeaheadItem[] = [];diff --git a/web/src/settings_playgrounds.ts b/web/src/settings_playgrounds.tsindex 0bbcf98eb22..cc042010757 100644--- a/web/src/settings_playgrounds.ts+++ b/web/src/settings_playgrounds.ts@@ -170,7 +170,6 @@ function build_page(): void {return [...language_labels.keys()];},items: 5,- fixed: true,helpOnEmptyStrings: true,highlighter_html: (item: string): string =>render_typeahead_item({primary: language_labels.get(item)}),diff --git a/web/tests/pill_typeahead.test.js b/web/tests/pill_typeahead.test.jsindex 5b9063df261..c95dfcf128d 100644--- a/web/tests/pill_typeahead.test.js+++ b/web/tests/pill_typeahead.test.js@@ -162,7 +162,6 @@ run_test("set_up", ({mock_template, override, override_rewire}) => {override(bootstrap_typeahead, "Typeahead", (input_element, config) => {assert.equal(input_element.$element, $fake_input);assert.equal(config.items, 5);- assert.ok(config.fixed);assert.ok(config.dropup);assert.ok(config.stopAdvance);