Invisible elements and mouse

Is it supposed to be the case that invisible VisualElements still interact with the mouse? I have some overlays which I’m setting visible = false on, but their child elements still seem to be keeping other elements from getting mouse over.

I’m sure I can resolve this by setting style.display = DisplayStyle.None but since the overlay should fade out, I’ll have to handle the timing of that.

Whether a visual element should register mouse events is handled by the picking mode property: Unity - Scripting API: UIElements.VisualElement.pickingMode

Right, but that’s a pain since I want to hide the parent (which visually hides the children). I’d like a solution which only involves the container, which contains a mix of pick and non-pick children.

Hi @alakoring ,

If I understand correctly, you want a USS-only solution to make sure that the container’s children do not catch mouse events?

I’d settle for code, but yes. I want to show an entire subtree over other UI, have its elements get mouse events while visible, and then fade it out and no longer block the underlying UI.

Just to make sure that I understand, you’re looking to make sure that none of the children react to the mouse when the container’s visible = false? Regardless of if said children are meant to be picked when the container is visible?

Right. There’s a popup display, which is positioned by a parent. And the popup should interact with the mouse (actually all it does is block clicks on the popup canceller element). If I turn off parent visibility, the popup no longer shows — but still blocks clicks.
I’m not a web developer but I think in pretty much every view system I’ve used, hiding a view prevents any UI interaction. So that’s what I’m expecting.
Actually, I think what I expect is a lot like SetActive(false) on a GameObject. You don’t see it or interact with it.