Revert "search: Fix blur event handler for search_query_box."

This reverts commit 63643c9d9d.

As the commit mentions, it makes a UI change for legacy search which
has largely been considered a regression.  We've been running with
this reverted in zulip.com essentially since it was first merged.
This commit is contained in:
Tim Abbott
2020-07-14 12:26:28 -07:00
parent 42d601e214
commit cb54e30832
3 changed files with 26 additions and 14 deletions

View File

@@ -91,15 +91,7 @@ exports.initialize = function () {
if (page_params.search_pills_enabled) {
search_pill.append_search_string(search_string,
search_pill_widget.widget);
if (search_query_box.is(':focus')) {
// We usually allow the user to continue
// typing until the enter key is pressed.
// But we narrow when the user clicks on a
// typeahead suggestion. This change in behaviour
// is a workaround to be able to display the
// navbar every time search_query_box loses focus.
return search_query_box.val();
}
return search_query_box.val();
}
return exports.narrow_or_search_for_term(search_string);
},
@@ -175,7 +167,7 @@ exports.initialize = function () {
// selecting something in the typeahead menu causes
// the box to lose focus a moment before.
//
// The workaround is to check 300ms later -- long
// The workaround is to check 100ms later -- long
// enough for the search to have gone through, but
// short enough that the user won't notice (though
// really it would be OK if they did).
@@ -194,10 +186,18 @@ exports.initialize = function () {
}
setTimeout(() => {
exports.update_button_visibility();
}, 100);
});
if (page_params.search_pills_enabled) {
// Uses jquery instead of pure css as the `:focus` event occurs on `#search_query`,
// while we want to add box-shadow to `#searchbox`. This could have been done
// with `:focus-within` CSS selector, but it is not supported in IE or Opera.
searchbox.on('focusout', function () {
tab_bar.close_search_bar_and_open_narrow_description();
searchbox.css({"box-shadow": "unset"});
}, 300);
});
});
}
};
exports.focus_search = function () {