Do you have a professional suggestion how to best integrate a functionality to close any opened Layer as soon as the user clicks “elsewhere”? I mean: once the element is opened, the user currently must use the X CLOSE elment to close the opened container. Do you see a good approach to trigger “cose” also if the user clicks anywhere outside the opened element?
A standard “trick” is to put a fixed transparent layer just underneath the element that has CSS with fixed:true;top:0;right:0;bottom:0;left:0;
with the appropriate z-index
set. Then you can add a click handler to that element which will close the modal. (and only display that transparent layer when the modal is open)
Here’s a quick example: https://anymod.com/mod/aklrr
thank you. Your quick example indeed helped to get me going. I managed to inject the Underlay into my mod and was able to finetune my mod to work well together with the new underlay.