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.

search: Fix display of suggestion box when search bar empty.

Lakshay Mittal0b10a335659c
diff --git a/web/src/search.js b/web/src/search.js
index d6cfc9be529..21f90c006c7 100644
--- a/web/src/search.js
+++ b/web/src/search.js
@@ -93,6 +93,9 @@ export function initialize() {
parentElement: "#searchbox_legacy",
items: search_suggestion.max_num_of_search_results,
helpOnEmptyStrings: true,
+ // With search pills, the contenteditable input will be empty
+ // even if some pills are present.
+ hideOnEmpty: page_params.search_pills_enabled,
naturalSearch: true,
highlighter(item) {
const obj = search_map.get(item);
diff --git a/web/third/bootstrap-typeahead/typeahead.js b/web/third/bootstrap-typeahead/typeahead.js
index eb5120499d9..9c9fcf60eb7 100644
--- a/web/third/bootstrap-typeahead/typeahead.js
+++ b/web/third/bootstrap-typeahead/typeahead.js
@@ -487,8 +487,13 @@ import {get_string_diff} from "../../src/util";
default:
var hideOnEmpty = false
- if (e.keyCode === 8 && this.options.helpOnEmptyStrings) { // backspace
- hideOnEmpty = true
+ // backspace
+ if (e.keyCode === 8 && this.options.helpOnEmptyStrings) {
+ // Support for inputs to set the hideOnEmpty option explicitly to false
+ // to display typeahead after hitting backspace to clear the input.
+ if (typeof(this.options.hideOnEmpty) === undefined || this.options.hideOnEmpty) {
+ hideOnEmpty = true;
+ }
}
this.lookup(hideOnEmpty)
}