From dd0efdc63716297a8393fa20fccc0e032bfc7a27 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 15 Jan 2024 17:31:44 +0100 Subject: [PATCH] Fixed SetKeyboardFocusHere() not working when current nav focus is in different scope. (#7226) Amend 70f2aaff --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 20de27acf..fab54b072 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -46,6 +46,8 @@ Breaking changes: Other changes: +- Fixed SetKeyboardFocusHere() not working when current nav focus is in different scope, + regression from 1.90.1 related to code scoping Tab presses to local scope. (#7226) [@bratpilz] - Backends: Vulkan: Fixed vkMapMemory() calls unnecessarily using full buffer size. (#3957) - Backends: Vulkan: Fixed handling of ImGui_ImplVulkan_InitInfo::MinAllocationSize field. (#7189, #4238) diff --git a/imgui.cpp b/imgui.cpp index 2d9ea91ba..8db1bbedc 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11383,10 +11383,12 @@ void ImGui::NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flag ImGuiContext& g = *GImGui; if ((move_flags & ImGuiNavMoveFlags_FocusApi) == 0) + { if (g.NavLayer != g.CurrentWindow->DC.NavLayerCurrent) return; - if (g.NavFocusScopeId != g.CurrentFocusScopeId) - return; + if (g.NavFocusScopeId != g.CurrentFocusScopeId) + return; + } // - Can always land on an item when using API call. // - Tabbing with _NavEnableKeyboard (space/enter/arrows): goes through every item.