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.

composebox_typeahead: Prevent default actions only after triggering the focus.

akshatdalton30435d79433e
diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js
index 4bb9e4eb880..33c87c1840d 100644
--- a/static/js/composebox_typeahead.js
+++ b/static/js/composebox_typeahead.js
@@ -236,9 +236,6 @@ function handle_keydown(e) {
handle_enter($("#compose-textarea"), e);
}
} else if (on_stream || on_topic || on_pm) {
- // Prevent the form from submitting
- e.preventDefault();
-
// We are doing the focusing on keyup to not abort the typeahead.
if (on_stream) {
nextFocus = $("#stream_message_recipient_topic");
@@ -259,6 +256,9 @@ function handle_keyup(e) {
) {
nextFocus.trigger("focus");
nextFocus = false;
+
+ // Prevent the form from submitting
+ e.preventDefault();
}
}