Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
pm_list: Esc should clear search input if focused.
Shubham Padia682a214d6513
diff --git a/web/src/hotkey.js b/web/src/hotkey.jsindex 6134d7efa07..28ace0e7ca7 100644--- a/web/src/hotkey.js+++ b/web/src/hotkey.js@@ -40,6 +40,7 @@ import * as navigate from "./navigate";import * as overlays from "./overlays";import {page_params} from "./page_params";import * as playground_links_popover from "./playground_links_popover";+import * as pm_list from "./pm_list";import * as popover_menus from "./popover_menus";import * as popovers from "./popovers";import * as reactions from "./reactions";@@ -341,6 +342,11 @@ export function process_escape_key(e) {return true;}+ if (pm_list.is_zoomed_in() && $(".direct-messages-list-filter").is(":focus")) {+ pm_list.clear_search();+ return true;+ }+if (compose_state.composing()) {// Check if the giphy popover was open using compose box.// Hide GIPHY popover if it's open.diff --git a/web/src/pm_list.ts b/web/src/pm_list.tsindex 371c9c5d2bc..f0ed8d14e41 100644--- a/web/src/pm_list.ts+++ b/web/src/pm_list.ts@@ -22,6 +22,10 @@ let private_messages_collapsed = false;// This keeps track of if we're zoomed in or not.let zoomed = false;+export function is_zoomed_in(): boolean {+ return zoomed;+}+function get_private_messages_section_header(): JQuery {return $("#direct-messages-section-header");}@@ -226,6 +230,7 @@ export function clear_search(force_rerender = false): void {} else if (force_rerender) {update_private_messages();}+ $filter.trigger("blur");}const throttled_update_private_message = _.throttle(update_private_messages, 50);