Wallaby: Querying DOM element regardless of its visibility

I noticed that in the Wallaby.Query docs, under Query Options it says that the visible option “Determines if the query should return only visible elements (default: true ).”

I initially thought this meant that visible: false would match any visible or invisible element, since visible: true only matches visible elements. Using the option, however, it became clear visible: false matches invisible elements only.

Could it be an idea to have the option visibility that has values visible, invisible or any?

I often want to match elements regardless of whether they are visible or not. This would make that easier. Also, I have noticed that elements get hovered “spontaneously”, which may change their visibility unpredictably. That’s one reason why I don’t want to specify the visibility (true/false) when querying elements.

The type specifications say visible can be boolean() | :any - here’s the PR that added the :any option

1 Like

I would look into why this is happening because that isn’t normal. It sound like it might have to do with the mouse position. Are you programatically moving it at all? It could also be a bug in Wallaby of course.

Oh. That’s my bad.

Hadn’t considered checking the type spec.

But that’s great. Glad the :any option exists.

I am not moving the mouse programmatically when it happens.

My first guess was also that it had to do with the mouse position. I haven’t verified that, though.

1 Like