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: Don't "initiate search" if it's already open.

evykassirer083062cd11e3
diff --git a/web/src/search.js b/web/src/search.js
index 84e1fc96079..2685ea3aba0 100644
--- a/web/src/search.js
+++ b/web/src/search.js
@@ -140,7 +140,11 @@ export function initialize({on_narrow_search}) {
// when an option is selected and we're closing search).
// Instead we explicitly initiate search on click and on specific keyboard
// shortcuts.
- $search_query_box.on("click", initiate_search);
+ $search_query_box.on("click", (e) => {
+ if ($(e.target).parents(".navbar-search.expanded").length === 0) {
+ initiate_search();
+ }
+ });
$(".search_icon").on("mousedown", (e) => {
e.preventDefault();
@@ -178,10 +182,7 @@ export function initialize({on_narrow_search}) {
}
export function initiate_search() {
- const search_bar_already_open = $(".navbar-search.expanded").length > 0;
- if (!search_bar_already_open) {
- open_search_bar_and_close_narrow_description();
- }
+ open_search_bar_and_close_narrow_description();
// Open the typeahead after opening the search bar, so that we don't
// get a weird visual jump where the typeahead results are narrow