compose_tooltip: Remove delay for invalid messages.

Does what 714def080f
was trying to do without the side effects.
Fixes: 714def080f
This commit is contained in:
Apoorva Pendse
2025-03-11 08:36:32 +05:30
committed by Tim Abbott
parent 58f16468ca
commit 54fd02b173
8 changed files with 35 additions and 28 deletions

View File

@@ -209,7 +209,7 @@ export function initialize(): void {
});
tippy.delegate("body", {
target: "#compose-send-button",
target: "#compose-send-button:not(.disabled-message-send-controls)",
delay: EXTRA_LONG_HOVER_DELAY,
// By default, tippyjs uses a trigger value of "mouseenter focus",
// but by specifying "mouseenter", this will prevent showing the
@@ -217,18 +217,11 @@ export function initialize(): void {
trigger: "mouseenter",
appendTo: () => document.body,
onShow(instance) {
// Don't show send-area tooltips if the popover is displayed or if the send button is disabled.
// Don't show send-area tooltips if the popover is displayed.
if (popover_menus.is_scheduled_messages_popover_displayed()) {
return false;
}
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) {
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()));
@@ -237,6 +230,22 @@ export function initialize(): void {
},
});
tippy.delegate("body", {
target: "#compose-send-button.disabled-message-send-controls",
// 350px at 14px/1em
maxWidth: "25em",
onShow(instance) {
instance.setContent(
compose_recipient.get_posting_policy_error_message() ||
compose_validate.get_disabled_send_tooltip(),
);
},
appendTo: () => document.body,
onHidden(instance) {
instance.destroy();
},
});
tippy.delegate("body", {
target: ".narrow_to_compose_recipients",
delay: LONG_HOVER_DELAY,