compose_tooltips: Fix overlapping tooltips.

Previously, the send button's tooltip was triggered by
the entire message controls row, which also contains the
options button. This caused overlapping tooltips as the
options button has its own tooltip.

This commit resolves the issue by applying the tooltip
only to the send button.
This commit is contained in:
ubaidrmn
2025-03-08 00:11:22 +05:00
committed by Tim Abbott
parent d46afab036
commit 714def080f

View File

@@ -218,13 +218,17 @@ export function initialize(): void {
appendTo: () => document.body,
onShow(instance) {
// Don't show send-area tooltips if the popover is displayed or if the send button is disabled.
if (
popover_menus.is_scheduled_messages_popover_displayed() ||
$(".message-send-controls").hasClass("disabled-message-send-controls")
) {
if (popover_menus.is_scheduled_messages_popover_displayed()) {
return false;
}
if (user_settings.enter_sends) {
if ($(".message-send-controls").hasClass("disabled-message-send-controls")) {
instance.setContent(
compose_recipient.get_posting_policy_error_message() ||
compose_validate.get_disabled_send_tooltip(),
);
return undefined;
} else if (user_settings.enter_sends) {
instance.setContent(parse_html($("#send-enter-tooltip-template").html()));
} else {
instance.setContent(parse_html($("#send-ctrl-enter-tooltip-template").html()));
@@ -270,27 +274,6 @@ export function initialize(): void {
instance.destroy();
},
});
tippy.delegate("body", {
// TODO: Might need to target just the Send button itself
// in the new design
target: ".disabled-message-send-controls",
// 350px at 14px/1em
maxWidth: "25em",
onTrigger(instance) {
instance.setContent(
compose_recipient.get_posting_policy_error_message() ||
compose_validate.get_disabled_send_tooltip(),
);
},
content: () =>
compose_recipient.get_posting_policy_error_message() ||
compose_validate.get_disabled_send_tooltip(),
appendTo: () => document.body,
onHidden(instance) {
instance.destroy();
},
});
}
export function hide_compose_control_button_tooltips($row: JQuery): void {