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() {
|
export function escape_search() {
|
||||||
if (user_filter) {
|
if (user_filter) {
|
||||||
user_filter.escape_search();
|
user_filter.clear_and_hide_search();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ export class UserSearch {
|
||||||
return this.text() === "";
|
return this.text() === "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This clears search input but doesn't close
|
||||||
|
// the search widget unless it was already empty.
|
||||||
clear_search() {
|
clear_search() {
|
||||||
buddy_data.set_is_searching_users(false);
|
buddy_data.set_is_searching_users(false);
|
||||||
|
|
||||||
|
@ -57,14 +59,11 @@ export class UserSearch {
|
||||||
this._reset_items();
|
this._reset_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
escape_search() {
|
// This always clears and closes search.
|
||||||
if (this.empty()) {
|
clear_and_hide_search() {
|
||||||
this.close_widget();
|
this.clear_search();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$input.val("");
|
|
||||||
this._update_list();
|
this._update_list();
|
||||||
|
this.close_widget();
|
||||||
}
|
}
|
||||||
|
|
||||||
hide_widget() {
|
hide_widget() {
|
||||||
|
@ -83,14 +82,6 @@ export class UserSearch {
|
||||||
return this.$widget.hasClass("notdisplayed");
|
return this.$widget.hasClass("notdisplayed");
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_and_hide_search() {
|
|
||||||
if (!this.empty()) {
|
|
||||||
this.$input.val("");
|
|
||||||
this._update_list();
|
|
||||||
}
|
|
||||||
this.close_widget();
|
|
||||||
}
|
|
||||||
|
|
||||||
close_widget() {
|
close_widget() {
|
||||||
this.$input.trigger("blur");
|
this.$input.trigger("blur");
|
||||||
this.hide_widget();
|
this.hide_widget();
|
||||||
|
|
Loading…
Reference in New Issue