test4
test3
test2
Child1
Child2
test1
test0

"test1" is a modal element on top of the modal element "test2" which is a modal element on top of "test3".

Differently put, test3 was inserted first and pushed onto the modal stack. Then came test2, then test1.

Clicking outside "test3" destroys modal behaviour for all three modal elemets.

Clicking outside "test1" but on or inside "test2" destroys modal behaviour for "test1" (etc.).

"test4" and "test0" were not made modals and are therefore considered to be outside - even though they look "stacked".

**A greyed out box means the the modal behvaviour for that element has been turned off