From 64e5d1e5e387cb35b8419ad25e53f6dbe687969a Mon Sep 17 00:00:00 2001 From: Trey Moen <50057480+greatgitsby@users.noreply.github.com> Date: Sun, 13 Sep 2026 16:54:34 -0700 Subject: [PATCH] cabana: preserve selected menu color on hover (#38909) * cabana: unify menu highlight colors * cabana: preserve selected menu color on hover --- openpilot/tools/cabana/ui/dropdown.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openpilot/tools/cabana/ui/dropdown.h b/openpilot/tools/cabana/ui/dropdown.h index b73d8e39a2..e6ce25f16b 100644 --- a/openpilot/tools/cabana/ui/dropdown.h +++ b/openpilot/tools/cabana/ui/dropdown.h @@ -86,7 +86,12 @@ inline void EndPopup() { inline bool BeginMenu(const char *label, bool enabled = true) { PopupViewportScope viewport_scope; pushStyle(); - return finishBegin(ImGui::BeginMenu(label, enabled)); + // An open menu keeps its selection color while the pointer is over its label. + const bool selected = ImGui::IsPopupOpen(label); + if (selected) ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImGui::GetStyleColorVec4(ImGuiCol_Header)); + const bool open = ImGui::BeginMenu(label, enabled); + if (selected) ImGui::PopStyleColor(); + return finishBegin(open); } inline void EndMenu() { ImGui::PopStyleVar();