From 6dba4cf943362f87c787080a6ac8eacc856941d0 Mon Sep 17 00:00:00 2001 From: Sanchit Sharma Date: Wed, 17 Jul 2024 21:47:41 +0530 Subject: [PATCH] invite_stream_picker_pill: Hide typeahead after backspacing a pill. Include `hide_on_empty_after_backspace` when passing opts to `set_up_streams` Fixes: #30542. --- web/src/invite_stream_picker_pill.ts | 1 + web/src/pill_typeahead.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/web/src/invite_stream_picker_pill.ts b/web/src/invite_stream_picker_pill.ts index 07a5116f5f..39277c61c9 100644 --- a/web/src/invite_stream_picker_pill.ts +++ b/web/src/invite_stream_picker_pill.ts @@ -28,6 +28,7 @@ function create_item_from_stream_name( function set_up_pill_typeahead({pill_widget, $pill_container}: SetUpPillTypeaheadConfig): void { const opts = { help_on_empty_strings: true, + hide_on_empty_after_backspace: true, invite_streams: true, }; set_up_stream($pill_container.find(".input"), pill_widget, opts); diff --git a/web/src/pill_typeahead.ts b/web/src/pill_typeahead.ts index 9ed7522b12..e9cb88ce14 100644 --- a/web/src/pill_typeahead.ts +++ b/web/src/pill_typeahead.ts @@ -76,6 +76,7 @@ export function set_up_stream( pills: StreamPillWidget, opts: { help_on_empty_strings?: boolean; + hide_on_empty_after_backspace?: boolean; invite_streams?: boolean; update_func?: () => void; }, @@ -85,9 +86,11 @@ export function set_up_stream( type: "contenteditable", }; opts.help_on_empty_strings ??= false; + opts.hide_on_empty_after_backspace ??= false; new Typeahead(bootstrap_typeahead_input, { dropup: true, helpOnEmptyStrings: opts.help_on_empty_strings, + hideOnEmptyAfterBackspace: opts.hide_on_empty_after_backspace, source(_query: string): StreamPillData[] { return stream_pill.typeahead_source(pills, opts.invite_streams); },