That's sad but that's true:
There is not really such a thing as an “invisible” or “background” elements in UIA – when an element is gone, it will no longer be in the UIA tree. This is a good thing for assistive technologies (less pruning of the tree required), but can be troublesome for UI Automation frameworks. Historically we would tend to cache UI elements so we could get back to them again faster. When needed, one could call a mix of ShowWindow and accSelect with SELFLAG_TAKEFOCUS. This no longer works. If, say, a tool window is tabbed and not in the foreground; our cached element for it will because invalid, and if it’s requested we need to a) bring it into the foreground and b) find the element from scratch again.