How do I set up a modal to be closed on backdrop click?

Hi,

I’m having trouble trying to close a modal by clicking outside it in (in the backdrop zone). Basically I want the modal to close wherever the user clicks outside the modal container.

The element tree is something like: modal section → modal container/form → submit button

I did an on-click workflow in the modal section to close the modal and I also did an on-click workflow with a stop click propagation action in the modal container, but then, the modal submit button doesn’t work. I expected the stop click propagation action would affect the bubbling event propagation phase but it seems that it affects the capture phase too. Isn’t it strange? The capture phase is rarely used.

Does anyone know how I could achieve this?

Hello,

Go into your modal workflow, select the action “on backdrop click”, add a block “change variable” and set a predefined bolean variable to false. Bind the bolean into your modal display property.

Cheers