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.

popover_menus: Fix bug in user card shortcut.

Kislay Verma426b97a2e5f3
diff --git a/web/src/popover_menus.ts b/web/src/popover_menus.ts
index ae8adf7f409..b93831b5f55 100644
--- a/web/src/popover_menus.ts
+++ b/web/src/popover_menus.ts
@@ -418,6 +418,12 @@ export function toggle_popover_menu(
): tippy.Instance {
const instance = target._tippy;
if (instance) {
+ // Ideally, we'd check that the _tippy object is a
+ // popover. For elements that host both a Tippy tooltip and a
+ // popover, this can incorrectly return early after hiding the
+ // Tippy tooltip.
+ //
+ // If we fix this, we can remove a few popovers.hide_all calls.
hide_current_popover_if_visible(instance);
return instance;
}
diff --git a/web/src/user_card_popover.ts b/web/src/user_card_popover.ts
index 21802018730..945143d7970 100644
--- a/web/src/user_card_popover.ts
+++ b/web/src/user_card_popover.ts
@@ -31,6 +31,7 @@ import {page_params} from "./page_params.ts";
import type {User} from "./people.ts";
import * as people from "./people.ts";
import * as popover_menus from "./popover_menus.ts";
+import * as popovers from "./popovers.ts";
import {hide_all} from "./popovers.ts";
import * as presence from "./presence.ts";
import * as rows from "./rows.ts";
@@ -573,6 +574,14 @@ export function toggle_sender_info(): void {
message_user_card.hide();
return;
}
+
+ // The "View user card" tooltip shown when hovering the avatar can
+ // block this from opening properly, so close it first.
+ //
+ // This isn't necessary for the click handler, because the click
+ // naturally closes the Tippy tooltip.
+ popovers.hide_all();
+
const $message = $(".selected_message");
let $sender = $message.find(".message-avatar");
if ($sender.length === 0) {