From 5598f63d0fbe9784f4b0a8af16a71a252c9c386a Mon Sep 17 00:00:00 2001 From: Andrew January Date: Thu, 8 Jul 2021 00:24:06 +0100 Subject: [PATCH] WindowServer: Make descending into submenu make the submenu current This fixes a bug with menu keyboard navigation. If you pressed the right arrow to enter a submenu, then the left arrow to exit the submenu, then right and left again it would leave no menu item selected. Because descending into the submenu wasn't making it the current menu, when you press the left arrow it couldn't find the "current menu" in the stack, so didn't know what menu to pop back to. It was an accident that it worked the first time you navigated into the menu. Selecting the parent item also opened the submenu, and opening an already open menu sets it as the current menu. After closing the submenu with the left arrow, it is no longer already open, so it wasn't getting set as the current menu. --- Userland/Services/WindowServer/Menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 88fc2ffc2c..dd55b7418f 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -322,7 +322,7 @@ void Menu::descend_into_submenu_at_hovered_item() VERIFY(hovered_item()); auto submenu = hovered_item()->submenu(); VERIFY(submenu); - MenuManager::the().open_menu(*submenu, false); + MenuManager::the().open_menu(*submenu, true); submenu->set_hovered_index(0); VERIFY(submenu->hovered_item()->type() != MenuItem::Separator); }