I'm going to go with a much cleaner, less error-prone solution, actually.
lua Code:
local function setAlphaZero()
if not CompactRaidFrameManagerDisplayFrame:IsVisible() then
CompactRaidFrameManager:SetAlpha(0)
end
end
CompactRaidFrameContainer:SetParent(UIParent)
CompactRaidFrameManager:SetAlpha(0)
CompactRaidFrameManager:HookScript("OnEnter", function() CompactRaidFrameManager:SetAlpha(1) end)
CompactRaidFrameManager:HookScript("OnLeave", setAlphaZero)
CompactRaidFrameManagerToggleButton:HookScript("OnEnter", function() CompactRaidFrameManager:SetAlpha(1) end)
CompactRaidFrameManagerToggleButton:HookScript("OnLeave", setAlphaZero)
I tried replacing the hooks on ToggleButton with an extra
CompactRaidFrameManager:IsMouseOver() check, like what Fizzle did, but it gave wonky results where the side bar remains visible when you close the raid frame manager drawer, until you manually move your mouse back over and away again to "refresh" it, so I'll probably keep it like that.