diff --git a/help/keyboard-shortcuts.md b/help/keyboard-shortcuts.md index ae27e5d2e4..3d739cce62 100644 --- a/help/keyboard-shortcuts.md +++ b/help/keyboard-shortcuts.md @@ -201,6 +201,8 @@ Keyboard navigation (e.g. arrow keys) works as expected. * **Toggle gear menu**: G +* **Open personal menu**: G + → + ### For a selected message (outlined in blue) * **Toggle emoji reactions menu**: : diff --git a/web/src/hotkey.js b/web/src/hotkey.js index c0678df6aa..ac7f91e2c4 100644 --- a/web/src/hotkey.js +++ b/web/src/hotkey.js @@ -733,15 +733,29 @@ export function process_hotkey(e, hotkey) { return false; } - if (hotkey.message_view_only && popover_menus.is_gear_menu_popover_displayed()) { - // Inside the gear menu, we don't process most hotkeys; the - // exception is that the gear_menu hotkey should toggle the - // menu closed again. + // We don't need to process arrow keys in navbar menus for spectators + // since they only have gear menu present. + if ( + popover_menus.is_personal_menu_popover_displayed() && + event_name === "left_arrow" && + !page_params.is_spectator + ) { + // Open gear menu popover on left arrow. + $("#personal-menu").trigger("click"); + gear_menu.toggle(); + return true; + } + + if (popover_menus.is_gear_menu_popover_displayed()) { if (event_name === "gear_menu") { gear_menu.toggle(); return true; + } else if (event_name === "right_arrow" && !page_params.is_spectator) { + // Open personal menu popover on g + right arrow. + gear_menu.toggle(); + $("#personal-menu").trigger("click"); + return true; } - return false; } if (overlays.settings_open() && !user_card_popover.user_card.is_open()) { diff --git a/web/src/popover_menus.js b/web/src/popover_menus.js index b84ab52da9..f4f19ede40 100644 --- a/web/src/popover_menus.js +++ b/web/src/popover_menus.js @@ -99,6 +99,10 @@ export function is_compose_enter_sends_popover_displayed() { return popover_instances.compose_enter_sends?.state.isVisible; } +export function is_personal_menu_popover_displayed() { + return popover_instances.personal_menu?.state.isVisible; +} + export function is_gear_menu_popover_displayed() { return popover_instances.gear_menu?.state.isVisible; } diff --git a/web/templates/keyboard_shortcuts.hbs b/web/templates/keyboard_shortcuts.hbs index 1eafc06323..fe813aade5 100644 --- a/web/templates/keyboard_shortcuts.hbs +++ b/web/templates/keyboard_shortcuts.hbs @@ -313,6 +313,10 @@