Skip to content

Commit a711915

Browse files
committed
EndMainMenuBar doesn't attempt to restore focus when there's an active id. (ocornut#8355)
I don't have a specific issue in mind but it seems sane to add that test.
1 parent dfd1bc3 commit a711915

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

imgui_widgets.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8769,7 +8769,7 @@ void ImGui::EndMainMenuBar()
87698769
// When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
87708770
// FIXME: With this strategy we won't be able to restore a NULL focus.
87718771
ImGuiContext& g = *GImGui;
8772-
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest)
8772+
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest && g.ActiveId == 0)
87738773
FocusTopMostWindowUnderOne(g.NavWindow, NULL, NULL, ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild);
87748774

87758775
End();

0 commit comments

Comments
 (0)