navbar_menu: Refactor keyboard events for navbar menu.

This commit extracts menu switching logic from `handle_keyboard_events`
to separate `change_active_navbar_menu` to toggle between the current
active navbar menu and the adjacent navbar menu.
This commit is contained in:
Pratik Chanda 2024-11-22 02:13:33 +05:30 committed by Tim Abbott
parent 9d578247a7
commit 566e5e688b
1 changed files with 3 additions and 0 deletions

View File

@ -17,7 +17,10 @@ export function handle_keyboard_events(event_name) {
if (!allowed_events.has(event_name)) {
return false;
}
return change_active_navbar_menu(event_name);
}
function change_active_navbar_menu(event_name) {
// We don't need to process arrow keys in navbar menus for spectators
// since they only have gear menu present.
if (