<dialog
    hx-on:click="if(event.target === this) this.close()"
    hx-on:close="document.getElementById('modal').innerHTML=''"
>
    <div id="modal"
         hx-target="this"
         hx-on::after-swap="this.closest('dialog')?.showModal()"
         hx-swap="innerHTML">
    </div>
</dialog>

