popovers: Focus on first menu item when user profile opened by hotkey.

Adds focus_user_info_popover_item to popovers.js. When menus are
opened by hotkeys, first menu item is focused to enable further
keyboard navigation.
This commit is contained in:
Shubham Padia 2018-06-12 15:10:27 +05:30 committed by showell
parent 4516a72676
commit 5481dd11bc
1 changed files with 10 additions and 0 deletions

View File

@ -537,6 +537,13 @@ exports.hide_user_sidebar_popover = function () {
}
};
function focus_user_info_popover_item() {
// For now I recommend only calling this when the user opens the menu with a hotkey.
// Our popup menus act kind of funny when you mix keyboard and mouse.
var items = get_user_info_popover_items();
focus_first_popover_item(items);
}
exports.show_sender_info = function () {
var $message = $(".selected_message");
var $sender = $message.find(".sender_info_hover");
@ -551,6 +558,9 @@ exports.show_sender_info = function () {
var message = current_msg_list.get(rows.id($message));
var user = people.get_person_from_user_id(message.sender_id);
show_user_info_popover($sender[0], user, message);
if (current_message_info_popover_elem) {
focus_user_info_popover_item();
}
};
exports.register_click_handlers = function () {