Avoid reveal modal closing upon click of an element not in the DOM

When an element inside the modal is removed on click, the modal would close because then the clicked element is not within the modal anymore (because it has been removed from the DOM). This example removes the button inside the modal on click and the modal should remain open. See issue #9146.

Clicking any of these triggers should close the modal.