mirror of https://github.com/zulip/zulip.git
search pills: Narrow when typeahead is not used.
We can remove the typeahead by clicking outside the search box after we have entered the search string to be filtered and then focus on the searchbox and press enter or just by pressing enter on an empty string. Previously, the narrow would just deactivate for the above condition as the searchbox value which was passed as the raw_operators parameter to the narrow.activate function was empty. This happened because we called the activate function on pressing enter for the keyup event, while the keydown event in the parent container made a pill from the text and cleared the input. (as mentioned in the comment for `KEY.ENTER` case in `input_pill.js`)
This commit is contained in:
parent
5f498f788f
commit
9e221977c4
|
@ -149,7 +149,17 @@ exports.initialize = function () {
|
|||
// operators. (The reason the other actions don't call
|
||||
// this codepath is that they first all blur the box to
|
||||
// indicate that they've done what they need to do)
|
||||
narrow.activate(Filter.parse(search_query_box.val()), {trigger: 'search'});
|
||||
|
||||
let operators = Filter.parse(search_query_box.val());
|
||||
if (page_params.search_pills_enabled) {
|
||||
// Pill is already added during keydown event of input pills.
|
||||
// Thus we can't call narrow_or_search_for_term as the
|
||||
// search_query_box has empty value.
|
||||
const base_query = search_pill.get_search_string_for_current_filter(
|
||||
search_pill_widget.widget);
|
||||
operators = Filter.parse(base_query);
|
||||
}
|
||||
narrow.activate(operators, {trigger: 'search'});
|
||||
search_query_box.blur();
|
||||
update_buttons_with_focus(false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue