Skip to content

Commit

Permalink
EndMainMenuBar doesn't attempt to restore focus when there's an activ…
Browse files Browse the repository at this point in the history
…e id. (#8355)

I don't have a specific issue in mind but it seems sane to add that test.
  • Loading branch information
ocornut committed Jan 29, 2025
1 parent dfd1bc3 commit a711915
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8769,7 +8769,7 @@ void ImGui::EndMainMenuBar()
// When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
// FIXME: With this strategy we won't be able to restore a NULL focus.
ImGuiContext& g = *GImGui;
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest)
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest && g.ActiveId == 0)
FocusTopMostWindowUnderOne(g.NavWindow, NULL, NULL, ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild);

End();
Expand Down

0 comments on commit a711915

Please sign in to comment.