diff --git a/imgui.cpp b/imgui.cpp index 186f262c..cd6aed41 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4132,7 +4132,7 @@ void ImGui::SetItemAllowOverlap() void ImGui::SetItemDefaultFocus() { ImGuiContext& g = *GImGui; - if (g.NavWindow == g.CurrentWindow->RootNavWindow && (g.NavInitDefaultRequest || g.NavInitDefaultResultId != 0)) + if (g.NavWindow == g.CurrentWindow->RootNavWindow && (g.NavInitDefaultRequest || g.NavInitDefaultResultId != 0) && g.NavLayer == g.NavWindow->DC.NavLayerCurrent) { g.NavInitDefaultRequest = false; g.NavInitDefaultResultExplicit = true; diff --git a/imgui_demo.cpp b/imgui_demo.cpp index b7e77a79..637adb8e 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2420,7 +2420,7 @@ struct ExampleAppConsole // Demonstrate keeping focus on the input box ImGui::SetItemDefaultFocus(); - if (ImGui::IsItemHovered() || reclaim_focus) + if (reclaim_focus) //|| ImGui::IsItemHovered()) ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget ImGui::End();