diff --git a/web/src/compose_actions.js b/web/src/compose_actions.js
index 18f28ba15d..418a69e1eb 100644
--- a/web/src/compose_actions.js
+++ b/web/src/compose_actions.js
@@ -48,7 +48,7 @@ function hide_box() {
// This is the main hook for saving drafts when closing the compose box.
drafts.update_draft();
blur_compose_inputs();
- $("#stream_message_recipient_topic").hide();
+ $("#compose_recipient_box").hide();
$("#compose-direct-recipient").hide();
$(".new_message_textarea").css("min-height", "");
compose_fade.clear_compose();
diff --git a/web/src/compose_recipient.js b/web/src/compose_recipient.js
index 973191b3e9..c90d941d3b 100644
--- a/web/src/compose_recipient.js
+++ b/web/src/compose_recipient.js
@@ -165,14 +165,14 @@ function update_recipient_label(stream_id) {
export function update_compose_for_message_type(message_type, opts) {
if (message_type === "stream") {
$("#compose-direct-recipient").hide();
- $("#stream_message_recipient_topic").show();
+ $("#compose_recipient_box").show();
$("#stream_toggle").addClass("active");
$("#private_message_toggle").removeClass("active");
$("#compose-recipient").removeClass("compose-recipient-direct-selected");
update_recipient_label(opts.stream_id);
} else {
$("#compose-direct-recipient").show();
- $("#stream_message_recipient_topic").hide();
+ $("#compose_recipient_box").hide();
$("#stream_toggle").removeClass("active");
$("#private_message_toggle").addClass("active");
$("#compose-recipient").addClass("compose-recipient-direct-selected");
diff --git a/web/src/compose_setup.js b/web/src/compose_setup.js
index 30986ba967..d83974589b 100644
--- a/web/src/compose_setup.js
+++ b/web/src/compose_setup.js
@@ -362,6 +362,25 @@ export function initialize() {
compose_recipient.update_placeholder_text();
});
+ $("#compose_recipient_box").on("click", "#recipient_box_clear_topic_button", () => {
+ const $input = $("#stream_message_recipient_topic");
+ const $button = $("#recipient_box_clear_topic_button");
+
+ $input.val("");
+ $input.trigger("focus");
+ $button.hide();
+ });
+
+ $("#compose_recipient_box").on("input", "#stream_message_recipient_topic", (e) => {
+ const $button = $("#recipient_box_clear_topic_button");
+ const value = $(e.target).val();
+ if (value.length === 0) {
+ $button.hide();
+ } else {
+ $button.show();
+ }
+ });
+
$("#stream_message_recipient_topic").on("focus", () => {
compose_recipient.update_placeholder_text();
});
diff --git a/web/styles/compose.css b/web/styles/compose.css
index 7bf54df137..d686c47e8e 100644
--- a/web/styles/compose.css
+++ b/web/styles/compose.css
@@ -617,7 +617,7 @@ textarea.new_message_textarea {
}
textarea.new_message_textarea,
-.compose_table .recipient_box {
+#compose_recipient_box {
border: 1px solid hsl(0deg 0% 0% / 20%);
box-shadow: none;
transition: border 0.2s ease;
@@ -630,11 +630,64 @@ textarea.new_message_textarea,
}
}
-input.recipient_box {
- margin: 0;
- padding: 0 6px;
- height: auto;
+#compose_recipient_box {
+ display: flex;
+ flex: 1 1 0;
border-radius: 3px;
+ background: hsl(0deg 0% 100%);
+
+ /* Give the recipient box, a `
`, the
+ correct styles when focus is in the
+ #stream_message_recipient_topic `
` */
+ &:focus-within {
+ outline: 0;
+ border: 1px solid hsl(0deg 0% 67%);
+ box-shadow: none;
+ }
+
+ #stream_message_recipient_topic,
+ #recipient_box_clear_topic_button {
+ background: none;
+ border: none;
+ }
+
+ /* Styles for input in the recipient_box */
+ #stream_message_recipient_topic {
+ /* Override inherited widths; flexbox will ensure
+ that it grows to fit. */
+ width: 0;
+ flex: 1 1 0;
+
+ /* Override flexbox's effective `max-content` min-width */
+ overflow: hidden;
+ text-overflow: ellipsis;
+
+ box-shadow: none;
+ outline: none;
+
+ padding: 4px 6px;
+ }
+
+ /* Styles for new conversation button in the recipient_box */
+ #recipient_box_clear_topic_button {
+ /* Set the border radius smaller, relative to the parent */
+ border-radius: 2px;
+ padding: 6px;
+ margin: 1px;
+
+ .zulip-icon {
+ display: block;
+ }
+
+ &:hover {
+ background-color: hsl(231deg 100% 90% / 20%);
+ }
+ }
+
+ /* This will reset the bootstrap margin-bottom: 10px value for the inputs */
+ & input {
+ margin-bottom: 0;
+ }
}
#compose_select_recipient_widget {
@@ -647,14 +700,6 @@ input.recipient_box {
}
}
-#stream_message_recipient_topic.recipient_box {
- width: 100%;
- /* This width roughly corresponds to how long of a topic can appear in
- the left sidebar with a single digit unread count without being
- cut off. */
- max-width: 175px;
-}
-
#private_message_recipient.recipient_box {
width: 100%;
}
@@ -748,7 +793,7 @@ input.recipient_box {
#compose-recipient {
display: flex;
- width: 100%;
+ flex: 1 1 0;
/* Use this containing flex element to
establish the minimum height of all its
children; the default `align-items: stretch`
diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.css
index d3d3cd2495..008b88b9cd 100644
--- a/web/styles/dark_theme.css
+++ b/web/styles/dark_theme.css
@@ -490,7 +490,8 @@
.pill-container,
.user-status-content-wrapper,
#custom-expiration-time-input,
- #org-join-settings .dropdown-widget-button {
+ #org-join-settings .dropdown-widget-button,
+ #compose_recipient_box {
background-color: hsl(0deg 0% 0% / 20%);
border-color: hsl(0deg 0% 0% / 60%);
color: inherit;
@@ -597,7 +598,7 @@
input[type="number"]:focus,
textarea:focus,
textarea.new_message_textarea:focus,
- .compose_table .recipient_box:focus {
+ #compose_recipient_box:focus {
border-color: hsl(0deg 0% 0% / 90%);
}
diff --git a/web/templates/compose.hbs b/web/templates/compose.hbs
index 18cb245f53..6c208811a2 100644
--- a/web/templates/compose.hbs
+++ b/web/templates/compose.hbs
@@ -63,7 +63,12 @@
-
+
+
+
+
diff --git a/web/tests/compose_actions.test.js b/web/tests/compose_actions.test.js
index 72679f9065..854c5e7b5e 100644
--- a/web/tests/compose_actions.test.js
+++ b/web/tests/compose_actions.test.js
@@ -134,7 +134,7 @@ test("start", ({override, override_rewire, mock_template}) => {
let opts = {};
start("stream", opts);
- assert_visible("#stream_message_recipient_topic");
+ assert_visible("#compose_recipient_box");
assert_hidden("#compose-direct-recipient");
assert.equal(compose_state.stream_name(), "");