Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose (misc): Fix send message on enter in topic input.

Harsh Bansalee51474a05d5
diff --git a/web/src/compose.js b/web/src/compose.js
index 399fd608bbf..3700f43144e 100644
--- a/web/src/compose.js
+++ b/web/src/compose.js
@@ -395,3 +395,7 @@ function schedule_message_to_custom_date() {
error,
});
}
+
+export function is_topic_input_focused() {
+ return $("#stream_message_recipient_topic").is(":focus");
+}
diff --git a/web/src/composebox_typeahead.ts b/web/src/composebox_typeahead.ts
index 81c721c5590..b9e2d735201 100644
--- a/web/src/composebox_typeahead.ts
+++ b/web/src/composebox_typeahead.ts
@@ -345,7 +345,7 @@ function handle_keydown(
target_sel = `#${CSS.escape(target_id)}`;
}
- const on_topic = target_sel === "input#stream_message_recipient_topic";
+ const on_topic = target_sel === "#stream_message_recipient_topic";
const on_pm = target_sel === "#private_message_recipient";
const on_compose = target_sel === "#compose-textarea";
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index d65a14f8227..924a6131021 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -499,6 +499,11 @@ export function process_enter_key(e) {
return true;
}
+ // Don't send the message if topic box is focused.
+ if (compose.is_topic_input_focused()) {
+ return true;
+ }
+
return false;
}