From f124ef931dd0733cc70add782765001c6e5ca31a Mon Sep 17 00:00:00 2001 From: Sayam Samal Date: Mon, 22 Jul 2024 20:08:22 +0530 Subject: [PATCH] user_card_popover: Focus on menu options when opened with keyboard. When the user card is opened via the keyboard shortcut `U`, the initial focus should be on the first popover menu option, rather than the copy buttons or the custom profile field links which can be distracting due to the presence of tooltips on them. Fixes part of #31027. --- web/src/user_card_popover.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/user_card_popover.js b/web/src/user_card_popover.js index 0cea1954d6..730ca43d99 100644 --- a/web/src/user_card_popover.js +++ b/web/src/user_card_popover.js @@ -480,7 +480,9 @@ function get_user_card_popover_for_message_items() { return undefined; } - return $("li:not(.divider):visible a:not(.hide_copy_icon)", $popover); + // Return only the popover menu options that are visible, and not the + // copy buttons or the link items in the custom profile fields. + return $(".link-item .popover-menu-link", $popover).filter(":visible"); } // Functions related to the user card popover in the user sidebar.