mirror of https://github.com/zulip/zulip.git
navbar: Append space at the end of filter for search convenience.
As long as the current narrow isn't already a search narrow or empty, we add a single space at the end of the current filter so that the user can just press the right arrow key and begin typing their search term, instead of having to add a space themselves.
This commit is contained in:
parent
c81240547e
commit
bad60ca7be
|
@ -311,7 +311,11 @@ exports.activate = function (raw_operators, opts) {
|
|||
}
|
||||
|
||||
// Put the narrow operators in the search bar.
|
||||
$('#search_query').val(Filter.unparse(operators));
|
||||
// we append a space to make searching more convenient in some cases.
|
||||
if (filter && !filter.is_search()) {
|
||||
$('#search_query').val(Filter.unparse(operators) + " ");
|
||||
}
|
||||
|
||||
search.update_button_visibility();
|
||||
|
||||
compose_actions.on_narrow(opts);
|
||||
|
|
|
@ -87,7 +87,12 @@ exports.exit_search = function () {
|
|||
|
||||
// reset searchbox text
|
||||
const search_string = narrow_state.search_string();
|
||||
$("#search_query").val(search_string);
|
||||
// This does not need to be conditional like the corresponding
|
||||
// function call in narrow.activate because search filters are
|
||||
// not common narrows
|
||||
if (search_string !== "") {
|
||||
$("#search_query").val(search_string + " ");
|
||||
}
|
||||
} else {
|
||||
// for "searching narrows", we redirect
|
||||
window.location.replace(filter.generate_redirect_url());
|
||||
|
|
Loading…
Reference in New Issue