Skip to content

Add confirmation dialog when clicking "New" if model is dirty #580

@nachodiezgarcia

Description

@nachodiezgarcia

Currently, when a user clicks the "New" button in the toolbar, the canvas is cleared immediately. If the user has unsaved changes (the model is "dirty"), this leads to accidental data loss.

While the action can technically be reverted using Ctrl + Z, this is not a discoverable feature for new users, nor is it a standard pattern for destructive actions like clearing a project. A user who loses their work might not realize they can undo it and may end up restarting the project from scratch. (Like it happend to me that I had to do again the model).

Proposed Solution:
Implement a confirmation dialog that triggers only when the modeling section has unsaved changes.

  • Trigger: User clicks the "New" button.

  • Condition: Check if isDirty (or equivalent state) is true.

  • Message: "You have unsaved changes. Are you sure you want to create a new model? All current progress will be lost."

Actions:

Cancel: Closes the dialog and stays on the current model.

Confirm: Clears the canvas and starts a new model.

User Experience (UX):

This aligns with the behavior of existing confirmation dialogs (like issue #78 for field removal).

Prevents the "frustration factor" of losing complex schemas by a misclick.

Accesibilitie
Ensure the dialog follows ARIA patterns (role="alertdialog") and that focus is trapped within the modal when active.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions