How to detect when a popup is open using JS?

Hello everyone, I’m trying to implement something in my code, but I need to be able to identify when a popup is open using JS.

I’ve already tried to identify changes in the display and visibility properties. And also using mutation observer, but both approaches didn’t work.

Thanks in advance for any help.

You could make that an input. Is popup visible

Thanks @jared.gibb, I was already using this approach anyway and I think I’ll keep using it.