Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hotkey: Disable hotkeys when a modal is open.
Ganesh Pawar4df2fd2b6181
diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.jsindex 1c3d9f9c45c..e70e9183920 100644--- a/frontend_tests/node_tests/hotkey.js+++ b/frontend_tests/node_tests/hotkey.js@@ -61,6 +61,7 @@ const overlays = mock_esm("../../static/js/overlays", {lightbox_open: () => false,drafts_open: () => false,info_overlay_open: () => false,+ is_modal_open: () => false,});const popovers = mock_esm("../../static/js/popovers", {actions_popped: () => false,@@ -316,6 +317,11 @@ run_test("drafts closed launch", ({override}) => {assert_mapping("d", browser_history, "go_to_location");});+run_test("modal open", ({override}) => {+ override(overlays, "is_modal_open", () => true);+ test_normal_typing();+});+run_test("misc", () => {// Next, test keys that only work on a selected message.const message_view_only_keys = "@+>RjJkKsSuvi:GM";diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex 13a54dbd4e1..453842625dd 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -558,6 +558,10 @@ export function process_hotkey(e, hotkey) {return process_shift_tab_key();}+ if (overlays.is_modal_open()) {+ return false;+ }+// TODO: break out specific handlers for up_arrow,// down_arrow, and backspaceswitch (event_name) {