Skip to content

Modal closes automatically after JS native confirm() #120

@stefan-golus

Description

@stefan-golus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions