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: Fix buggy tooltip hotkey hint placement in compose send button.

Sayam Samal1c58dcddfa10
diff --git a/web/src/compose_tooltips.ts b/web/src/compose_tooltips.ts
index 1e7c4212c48..2498b95bab3 100644
--- a/web/src/compose_tooltips.ts
+++ b/web/src/compose_tooltips.ts
@@ -270,9 +270,6 @@ export function initialize(): void {
if (instance.reference.classList.contains("disabled-message-send-controls")) {
const error_message = compose_validate.get_disabled_send_tooltip_html();
instance.setContent(parse_html(error_message));
- // `display: flex` doesn't show the tooltip content inline when <i>general chat</i>
- // is in the error message.
- $(instance.popper).find(".tippy-content").css("display", "block");
if (!error_message) {
blueslip.error("Compose send button incorrectly disabled.");
diff --git a/web/src/compose_validate.ts b/web/src/compose_validate.ts
index 6aa2616920a..457357b7495 100644
--- a/web/src/compose_validate.ts
+++ b/web/src/compose_validate.ts
@@ -56,10 +56,17 @@ export const NO_PRIVATE_RECIPIENT_ERROR_MESSAGE = $t({
defaultMessage: "Please add a valid recipient.",
});
export const NO_CHANNEL_SELECTED_ERROR_MESSAGE = $t({defaultMessage: "Please select a channel."});
-export const get_topics_required_error_message_html = (): string =>
- render_topics_required_error_message({
+export const get_topics_required_error_tooltip_message_html = (): string => {
+ const error_message_html = render_topics_required_error_message({
empty_string_topic_display_name: util.get_final_topic_display_name(""),
});
+ // The `.tippy-content` element uses `display: flex`, which prevents the empty
+ // topic name from appearing italicized and inline within the error message text.
+ // To resolve this, we wrap the message in a `.tooltip-inner-content` div,
+ // allowing inline formatting and benefiting from the line height adjustment
+ // accompanying the class suitable for multi-line tooltips such as this one.
+ return `<div class="tooltip-inner-content">${error_message_html}</div>`;
+};
export const get_message_too_long_for_compose_error = (): string =>
$t(
{defaultMessage: `Message length shouldn't be greater than {max_length} characters.`},
@@ -858,7 +865,8 @@ function validate_stream_message(scheduling_message: boolean, show_banner = true
compose_banner.topic_missing_error(util.get_final_topic_display_name(""));
}
if (is_validating_compose_box) {
- disabled_send_tooltip_message_html = get_topics_required_error_message_html();
+ disabled_send_tooltip_message_html =
+ get_topics_required_error_tooltip_message_html();
}
return false;
}
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index 5de8dd78d6a..a25c0c42b8a 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -849,11 +849,9 @@ export function initialize(): void {
onShow(instance) {
const $elem = $(instance.reference);
if ($($elem).find(".topic_edit_save").prop("disabled")) {
- const error_message = compose_validate.get_topics_required_error_message_html();
+ const error_message =
+ compose_validate.get_topics_required_error_tooltip_message_html();
instance.setContent(ui_util.parse_html(error_message));
- // `display: flex` doesn't show the tooltip content inline when <i>general chat</i>
- // is in the error message.
- $(instance.popper).find(".tippy-content").css("display", "block");
return undefined;
}
instance.destroy();