InputText: reworked so that io.ConfigInputTextEnterKeepActive reactivate in order for e.g. IsItemDeactivatedAfterEdit() to work. (#9001, #9115)
diff --git a/imgui.cpp b/imgui.cpp
index f3b0c7b..b88ff1d 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -4281,6 +4281,7 @@
     MouseStationaryTimer = 0.0f;
 
     InputTextPasswordFontBackupFlags = ImFontFlags_None;
+    InputTextReactivateID = 0;
     TempInputId = 0;
     memset(&DataTypeZeroValue, 0, sizeof(DataTypeZeroValue));
     BeginMenuDepth = BeginComboDepth = 0;
diff --git a/imgui_internal.h b/imgui_internal.h
index 0de97ac..3cfac42 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -2461,6 +2461,7 @@
     ImGuiInputTextDeactivatedState InputTextDeactivatedState;
     ImFontBaked             InputTextPasswordFontBackupBaked;
     ImFontFlags             InputTextPasswordFontBackupFlags;
+    ImGuiID                 InputTextReactivateID;              // ID of InputText to reactivate on next frame (for ConfigInputTextEnterKeepActive behavior)
     ImGuiID                 TempInputId;                        // Temporary text input when using Ctrl+Click on a slider, etc.
     ImGuiDataTypeStorage    DataTypeZeroValue;                  // 0 for all data types
     int                     BeginMenuDepth;
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index cbb5126..355b63a 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -4762,6 +4762,11 @@
 
     const bool input_requested_by_nav = (g.ActiveId != id) && ((g.NavActivateId == id) && ((g.NavActivateFlags & ImGuiActivateFlags_PreferInput) || (g.NavInputSource == ImGuiInputSource_Keyboard)));
 
+    // Check if this InputText should be reactivated (for ConfigInputTextEnterKeepActive)
+    const bool input_requested_by_reactivate = (g.InputTextReactivateID == id);
+    if (input_requested_by_reactivate)
+        g.InputTextReactivateID = 0; // Clear the flag
+
     const bool user_clicked = hovered && io.MouseClicked[0];
     const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
     const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
@@ -4772,7 +4777,7 @@
 
     const bool init_reload_from_user_buf = (state != NULL && state->WantReloadUserBuf);
     const bool init_changed_specs = (state != NULL && state->Stb->single_line != !is_multiline); // state != NULL means its our state.
-    const bool init_make_active = (user_clicked || user_scroll_finish || input_requested_by_nav);
+    const bool init_make_active = (user_clicked || user_scroll_finish || input_requested_by_nav || input_requested_by_reactivate);
     const bool init_state = (init_make_active || user_scroll_active);
     if (init_reload_from_user_buf)
     {
@@ -5111,7 +5116,12 @@
             {
                 validated = true;
                 if (io.ConfigInputTextEnterKeepActive && !is_multiline)
+                {
+                    // Deactivate for one frame to trigger IsItemDeactivatedAfterEdit(), then reactivate
                     state->SelectAll(); // No need to scroll
+                    clear_active_id = true;
+                    g.InputTextReactivateID = id; // Mark for reactivation on next frame
+                }
                 else
                     clear_active_id = true;
             }