Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Use .compose-box-open to manage visibility.
Karl Stolley1102ca4f2256
diff --git a/web/src/compose_actions.ts b/web/src/compose_actions.tsindex 5c1afbe8cac..5efdb057ff7 100644--- a/web/src/compose_actions.ts+++ b/web/src/compose_actions.ts@@ -91,12 +91,8 @@ function hide_box(): void {// This is the main hook for saving drafts when closing the compose box.drafts.update_draft();blur_compose_inputs();- $("#compose_recipient_box").hide();- $("#compose-direct-recipient").hide();$(".new_message_textarea").css("min-height", "");compose_fade.clear_compose();- $(".message_comp").hide();- $("#compose_controls").show();// Assume a muted recipient row for the next time// the compose box is reopened$("#compose-recipient").addClass("low-attention-recipient-row");@@ -133,7 +129,7 @@ function show_compose_box(opts: ComposeActionsOpts): void {compose_ui.set_focus(opts_by_message_type);}// Transitions in the recipient row of the compose box are attached- // to this class we add a slight delay to avoid transitions firing+ // to this class; we add a slight delay to avoid transitions firing// immediately.requestAnimationFrame(() => {$("#compose").addClass("compose-box-open");@@ -203,8 +199,7 @@ export function rewire_autosize_message_content(value: typeof autosize_message_cexport let expand_compose_box = (): void => {$("#compose_close").attr("data-tooltip-template-id", "compose_close_tooltip_template");- $("#compose_controls").hide();- $(".message_comp").show();+ $("#compose").addClass("compose-box-open");};export function rewire_expand_compose_box(value: typeof expand_compose_box): void {diff --git a/web/styles/compose.css b/web/styles/compose.cssindex 400eb2db88d..2043ffc4236 100644--- a/web/styles/compose.css+++ b/web/styles/compose.css@@ -1223,6 +1223,16 @@ textarea.new_message_textarea {outline-color: transparent;}+.compose-box-open {+ #compose_controls {+ display: none;+ }++ .message_comp {+ display: block;+ }+}+/* We want transitions to run only on user interactions withthe mouse, once the compose box is open. Any keyboardinteractions (e.g., Shift-Tabbing from the compose textareadiff --git a/web/tests/compose_actions.test.cjs b/web/tests/compose_actions.test.cjsindex bd3a336e7e7..a891df3d853 100644--- a/web/tests/compose_actions.test.cjs+++ b/web/tests/compose_actions.test.cjs@@ -204,6 +204,7 @@ test("start", ({override, override_rewire, mock_template}) => {};start(opts);+ assert.ok($("#compose").hasClass("compose-box-open"));assert_visible("#compose_recipient_box");assert_hidden("#compose-direct-recipient");@@ -276,6 +277,7 @@ test("start", ({override, override_rewire, mock_template}) => {start(opts);+ assert.ok($("#compose").hasClass("compose-box-open"));assert_hidden("input#stream_message_recipient_topic");assert_visible("#compose-direct-recipient");@@ -308,12 +310,10 @@ test("start", ({override, override_rewire, mock_template}) => {});$("textarea#compose-textarea").set_height(50);- assert_hidden("#compose_controls");cancel();assert.ok(abort_xhr_called);assert.ok(pill_cleared);- assert_visible("#compose_controls");- assert_hidden("#compose-direct-recipient");+ assert.ok(!$("#compose").hasClass("compose-box-open"));assert.ok(!compose_state.composing());});