How can I disable the draggable option of an element using JavaScript?

My plugin has a lightbox that closes when you click outside of it. However, when I click on the lightbox, the draggable option of the editor widgets gets activated and seems to stop the propagation of other events. I think this is why the event listeners for the lightbox element don’t work in the builder, only on the frontend.

How can I disable the draggable option of an element via JavaScript? With this functionality, I was able to disable the draggable option only when the lightbox is active. I tried using CSS pseudo-selectors like :has(.epg-lightbox[style*="display: flex"]), but it only works on the frontend as well. I also tried preventing the propagation of events from all elements, but it didn’t work. It seems that the builder’s JavaScript takes priority over any solution I’ve tried.

Whenever I click on the lightbox, it stays like this, as if the lightbox has position: absolute, but it is sticky.

I couldn’t upload the first image, but it looks something like this.

Also, any function that triggers a click inside the lightbox is ignored :smile:

before any click