mirror of https://github.com/zulip/zulip.git
search: Don't use e.target for the query click handler.
This is preparation for search pills. The X button for user pills will be a click target that disappears from the DOM. We don't want to look for the parent of a click element that might not exist, since that would give us a false positive and lead us to reset the search bar when removing a user pill. This commit brings this click handler to a more stable state.
This commit is contained in:
parent
1045e322fd
commit
20e4778163
|
@ -172,8 +172,8 @@ export function initialize({on_narrow_search}: {on_narrow_search: OnNarrowSearch
|
|||
// when an option is selected and we're closing search).
|
||||
// Instead we explicitly initiate search on click and on specific keyboard
|
||||
// shortcuts.
|
||||
$search_query_box.on("click", (e: JQuery.ClickEvent): void => {
|
||||
if ($(e.target).parents(".navbar-search.expanded").length === 0) {
|
||||
$search_query_box.on("click", (): void => {
|
||||
if ($("#searchbox .navbar-search.expanded").length === 0) {
|
||||
initiate_search();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue