mirror of https://github.com/zulip/zulip.git
user search: Always close widget on escape instead of clearing first.
Fixes part of #27491
This commit is contained in:
parent
a764a3e66f
commit
ac0e03fe89
|
@ -217,7 +217,7 @@ export function initiate_search() {
|
|||
|
||||
export function escape_search() {
|
||||
if (user_filter) {
|
||||
user_filter.escape_search();
|
||||
user_filter.clear_and_hide_search();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ export class UserSearch {
|
|||
return this.text() === "";
|
||||
}
|
||||
|
||||
// This clears search input but doesn't close
|
||||
// the search widget unless it was already empty.
|
||||
clear_search() {
|
||||
buddy_data.set_is_searching_users(false);
|
||||
|
||||
|
@ -57,14 +59,11 @@ export class UserSearch {
|
|||
this._reset_items();
|
||||
}
|
||||
|
||||
escape_search() {
|
||||
if (this.empty()) {
|
||||
this.close_widget();
|
||||
return;
|
||||
}
|
||||
|
||||
this.$input.val("");
|
||||
// This always clears and closes search.
|
||||
clear_and_hide_search() {
|
||||
this.clear_search();
|
||||
this._update_list();
|
||||
this.close_widget();
|
||||
}
|
||||
|
||||
hide_widget() {
|
||||
|
@ -83,14 +82,6 @@ export class UserSearch {
|
|||
return this.$widget.hasClass("notdisplayed");
|
||||
}
|
||||
|
||||
clear_and_hide_search() {
|
||||
if (!this.empty()) {
|
||||
this.$input.val("");
|
||||
this._update_list();
|
||||
}
|
||||
this.close_widget();
|
||||
}
|
||||
|
||||
close_widget() {
|
||||
this.$input.trigger("blur");
|
||||
this.hide_widget();
|
||||
|
|
Loading…
Reference in New Issue