Closing modal window by clicking on greyed part of the UI


I am trying to find a way to close a modal sub-window by clicking the outside of the “sub-window”, which is only the modal part.

Subwindow has 75% width of the screen and the rest is just modal part (greyed out).

Blurlistener doesn’t work, because my sub-windows have a csslayout in it and if I click somewhere in csslayout, the window gets closed because it loses its focus.