Bag not closing while combat
tree87cloud opened this issue ยท 2 comments
Bag can be close with keybind(ESC) while combat
but can't be close by pressing X button on top right frame while combat
I know the problem is because HideUIPanel()
is protected and cannot be called during combat.
Patch 8.2.0/API changes
- ShowUIPanel() and HideUIPanel() are now protected, they can no longer be called by addons while in combat.
I couldn't find a normal solution because I can't find how HideUIPanel()
is triggered. But I found a workaround with it. Add this code to any Lua file and the problem will disappear:
hooksecurefunc("HideUIPanel", function(ui)
if InCombatLockdown() and type(ui) == 'table' and ui.bagToggle then
ui:Hide()
end
end)
It will use the ui:Hide()
method to close the bag in battle, which is not affected by the combat lockdown.