From 3836711b1252e1a2d0149e1ef3b72fa994c1b3ca Mon Sep 17 00:00:00 2001 From: Kevin Condon <51388684+KevinCondon@users.noreply.github.com> Date: Mon, 9 Mar 2026 22:11:38 -0400 Subject: [PATCH 1/2] Fix CraftQueue amount input losing focus during periodic updates AllocationsModified events trigger TriggerModuleUpdate which calls HideAllModules, hiding the CraftQueue frame and clearing EditBox focus. This makes it nearly impossible to type a craft amount before the input deselects (~2 seconds). Skip the module update when a craft amount input has focus so users can edit quantities without the field being destroyed and recreated. --- Init/Init.lua | 6 ++++++ Modules/CraftQueue/UI.lua | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Init/Init.lua b/Init/Init.lua index de2fa40b..789cdbd9 100644 --- a/Init/Init.lua +++ b/Init/Init.lua @@ -65,6 +65,12 @@ local hookedEvent = false local freshLoginRecall = true local lastCallTime = 0 function CraftSim.INIT:TriggerModuleUpdate(isInit) + -- Skip periodic updates while user is editing a craft queue input to prevent focus loss + if not isInit and CraftSim.CRAFTQ.UI and CraftSim.CRAFTQ.UI.HasFocusedInput and CraftSim.CRAFTQ.UI:HasFocusedInput() then + print("MODULE UPDATE SKIPPED - CraftQueue input has focus") + return + end + local callTime = GetTime() if lastCallTime == callTime then print("SAME FRAME, RETURN") diff --git a/Modules/CraftQueue/UI.lua b/Modules/CraftQueue/UI.lua index 4fb4aaad..71c95125 100644 --- a/Modules/CraftQueue/UI.lua +++ b/Modules/CraftQueue/UI.lua @@ -1674,6 +1674,25 @@ function CraftSim.CRAFTQ.UI:UpdateDisplay() CraftSim.CRAFTQ.UI:UpdateQueueDisplay() end +--- Returns true if any craft amount input in the queue list currently has focus +function CraftSim.CRAFTQ.UI:HasFocusedInput() + local queueTab = CraftSim.CRAFTQ.frame and CraftSim.CRAFTQ.frame.content and + CraftSim.CRAFTQ.frame.content.queueTab + if not queueTab then return false end + local craftList = queueTab.content and queueTab.content.craftList + if not craftList or not craftList.activeRows then return false end + for _, row in pairs(craftList.activeRows) do + local craftAmountColumn = row.columns and row.columns[9] + if craftAmountColumn and craftAmountColumn.input and + craftAmountColumn.input.textInput and + craftAmountColumn.input.textInput.frame and + craftAmountColumn.input.textInput.frame:HasFocus() then + return true + end + end + return false +end + ---@param craftQueueItem CraftSim.CraftQueueItem function CraftSim.CRAFTQ.UI:UpdateEditRecipeFrameDisplay(craftQueueItem) ---@type CraftSim.CRAFTQ.EditRecipeFrame From 5498010a7a86ad15d9064a46552b5b350d0357eb Mon Sep 17 00:00:00 2001 From: Kevin C Date: Thu, 12 Mar 2026 20:03:32 -0400 Subject: [PATCH 2/2] Scope focus-loss fix to CraftQueue module only Good catch on the review feedback! I moved the focus guard from TriggerModuleUpdate into HideAllModules and TriggerModulesByRecipeType so that only the CraftQueue hide/update is skipped when an input has focus. Other modules continue updating normally. --- Init/Init.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Init/Init.lua b/Init/Init.lua index 789cdbd9..038f3a21 100644 --- a/Init/Init.lua +++ b/Init/Init.lua @@ -65,12 +65,6 @@ local hookedEvent = false local freshLoginRecall = true local lastCallTime = 0 function CraftSim.INIT:TriggerModuleUpdate(isInit) - -- Skip periodic updates while user is editing a craft queue input to prevent focus loss - if not isInit and CraftSim.CRAFTQ.UI and CraftSim.CRAFTQ.UI.HasFocusedInput and CraftSim.CRAFTQ.UI:HasFocusedInput() then - print("MODULE UPDATE SKIPPED - CraftQueue input has focus") - return - end - local callTime = GetTime() if lastCallTime == callTime then print("SAME FRAME, RETURN") @@ -529,7 +523,10 @@ function CraftSim.INIT:HideAllModules(keepControlPanel) end -- hide all modules CraftSim.RECIPE_SCAN.frame:Hide() - CraftSim.CRAFTQ.frame:Hide() + -- Skip hiding CraftQueue frame if user is editing a craft amount input + if not (CraftSim.CRAFTQ.UI and CraftSim.CRAFTQ.UI.HasFocusedInput and CraftSim.CRAFTQ.UI:HasFocusedInput()) then + CraftSim.CRAFTQ.frame:Hide() + end CraftSim.CRAFT_BUFFS.frame:Hide() CraftSim.CRAFT_BUFFS.frameWO:Hide() CraftSim.COOLDOWNS.frame:Hide() @@ -731,8 +728,11 @@ function CraftSim.INIT:TriggerModulesByRecipeType() end -- update CraftQ Display (e.g. cause of profession gear changes) - CraftSim.CRAFTQ.UI:UpdateDisplay() - CraftSim.CRAFTQ.UI:UpdateAddOpenRecipeButton(recipeData) + -- Skip CraftQueue update if user is editing a craft amount input to prevent focus loss + if not (CraftSim.CRAFTQ.UI.HasFocusedInput and CraftSim.CRAFTQ.UI:HasFocusedInput()) then + CraftSim.CRAFTQ.UI:UpdateDisplay() + CraftSim.CRAFTQ.UI:UpdateAddOpenRecipeButton(recipeData) + end -- Simulation Mode (always update first because it changes recipeData based on simMode inputs) showSimulationMode = (showSimulationMode and recipeData and not recipeData.isSalvageRecipe) or false