svelte-simple-modal
svelte-simple-modal copied to clipboard
Modal closes automatically after JS native confirm()
trafficstars
Issue:
When using a confirmation dialog in a component opened within a modal, the modal closes automatically upon confirmation. This behavior is illustrated in the following code snippet:
Code:
<!-- ContentForModal.svelte -->
[...]
<script>
function invokeActionWithNativeJsConfirm() {
if (confirm('Are you sure?')) {
console.log('im sure');
}
}
</script>
[...]
<button
type="button"
on:click={() => {
invokeActionWithNativeJsConfirm();
}}>Delete
</button>
Steps to reproduce:
- Open the component in a modal.
- Trigger handleRemoveAddressClick.
- Confirm the action in the dialog.
Expected behavior: The modal should remain open after the confirmation dialog is handled.
Actual behavior: The modal closes automatically after the confirmation.