Back to compare picker

Unsaved changes prompt vs Exit warning vs Autosave form vs Confirmation dialog

Use an unsaved changes prompt for a focused dirty-editor decision before close, cancel, switch, or replacement. Use exit warning for broader departure, autosave form for background persistence, and confirmation dialog for an explicit consequential command.

Learn the decision

Match the interaction to the person's task

Use an unsaved changes prompt for a focused dirty-editor decision before close, cancel, switch, or replacement. Use exit warning for broader departure, autosave form for background persistence, and confirmation dialog for an explicit consequential command.

Unsaved changes prompt

Use it when: A close, cancel, switch, or edit-mode exit would discard unsaved local changes.

Make this state clear: Dirty editor state with changed-field tracking.

Observe the result: A user edits two fields, clicks Close, reviews the changed fields in the prompt, saves, and the editor closes only after the saved state is confirmed.

Study the full pattern →

Exit warning

Use it when: A route change, tab close, reload, browser Back, external link, or sign-out action can interrupt a task.

Make this state clear: Dirty unsaved state with local unsaved-work status.

Observe the result: A user chooses Discard and leave from an in-app warning and is taken to the intended destination with a clear understanding of what was discarded.

Study the full pattern →

Autosave form

Use it when: Users spend meaningful time entering form content or application progress.

Make this state clear: Initial state that explains progress will be saved automatically.

Observe the result: A user writes a long answer, pauses, sees Saving, then sees Draft saved just now and can leave knowing the draft is recoverable.

Study the full pattern →

Confirmation dialog

Use it when: The action is destructive, irreversible, costly, security-sensitive, privacy-affecting, or externally visible.

Make this state clear: Pre-action state with an explicit consequential trigger.

Observe the result: Cancel, Escape, and Keep archive leave the archive unchanged and return focus to Delete archive.

Study the full pattern →

Practice the judgment: Imagine this situation: A prompt says Are you sure? with OK and Cancel, forcing users to infer whether OK saves, discards, or leaves. Write the person's goal, choose one of these patterns, and show the state that helps the person continue. Use the decision rules and source trail below to explain your choice.

Review the underlying principle →

Decision dimensions

Dimension Unsaved changes promptExit warningAutosave formConfirmation dialog
UI or UX UI + UX - Dirty-editor decision prompt before closing, canceling, switching, or replacing unsaved editsUI + UX - Attempted-departure safeguard for unrecoverable in-progress workUI + UX - Background-saving form progressUI + UX - Consequential alert decision
UI guidance Name the edited object, summarize what changed, and offer distinct Save changes, Discard changes, Review changes, and Keep editing choices when the system can support them.Show a warning only when the user attempts to leave with real unsaved, pending, failed, or unrecoverable work; place in-app route warnings at the point of departure with Save and leave, Discard and leave, and Stay editing choices.Render a clear autosave message before users start, then keep a persistent status surface for Pending, Saving, Saved with timestamp, Failed, Retry, and unsafe-to-leave states.Render an alert-style modal decision with a specific title, consequence description, safe cancellation, and a destructive action label that names the object or scope.
UX guidance Use an unsaved changes prompt to protect local edits at the moment a user is about to abandon or replace them inside the product.Help the person reach a clear task outcome.Use autosave when losing progress would hurt and background persistence is safer than making users hunt for a distant Save button.Help the person reach a clear task outcome.
Good UI A profile editor close button opens Save changes to Billing contact?, lists edited phone and department fields, and offers Keep editing, Review changes, Save changes, or Discard changes.A grant form user clicks Back with two unsaved answers; a dialog names the changed section and offers Save and leave, Discard and leave, or Stay editing.A long application step says the application is saved on every change, shows Saving after an edited title blurs, then shows Draft saved just now with a timestamp.Delete Research archive? explains that 14 notes and shared links will be permanently removed, offers Keep archive, and labels the danger action Delete archive.
Bad UI A tab switch silently replaces the dirty editor with a different record and loses the user's typed notes.Every navigation shows Are you sure you want to leave? even after the form is saved.A green Saved toast appears after one field saves, while another changed field is still pending or failed.The red destructive action is enabled immediately and sits where users expect the routine primary button.
Good UX A user edits two fields, clicks Close, reviews the changed fields in the prompt, saves, and the editor closes only after the saved state is confirmed.A user chooses Discard and leave from an in-app warning and is taken to the intended destination with a clear understanding of what was discarded.A user writes a long answer, pauses, sees Saving, then sees Draft saved just now and can leave knowing the draft is recoverable.Cancel, Escape, and Keep archive leave the archive unchanged and return focus to Delete archive.
Bad UX A user chooses Save, the request fails, and the editor still closes as though the latest values were safe.A user clicks a sidebar link after typing a long answer and loses it because the product only watched final Submit.A password or permission field autosaves immediately and takes effect before the user reviewed the consequence.Every archive, filter, and dismiss action opens the same confirmation until users click through automatically.
Best fit A close, cancel, switch, or edit-mode exit would discard unsaved local changes.A route change, tab close, reload, browser Back, external link, or sign-out action can interrupt a task.Users spend meaningful time entering form content or application progress.The action is destructive, irreversible, costly, security-sensitive, privacy-affecting, or externally visible.
Avoid when Every latest change is already saved or safely recoverable.The page is clean, read-only, or all changes are safely saved and recoverable.The form is short enough that a visible manual Save or Submit is clearer.The action is routine and easily reversible.
Required state Dirty editor state with changed-field tracking.Dirty unsaved state with local unsaved-work status.Initial state that explains progress will be saved automatically.Pre-action state with an explicit consequential trigger.
Accessibility burden Use dialog or alertdialog semantics when the prompt interrupts the current task and requires a response.Use a real dialog or alertdialog for in-app warnings, with a heading that names the loss risk.Expose autosave status changes in a polite status region so assistive technology users hear Saving, Saved, and Failed states.Use alertdialog semantics or platform equivalent when the decision is urgent and requires a response.
Common misuse Prompting when nothing changed.Warning on every navigation regardless of whether work is dirty.Showing Saved when only an older change was saved.Asking users to confirm every routine action until they stop reading.

Unsaved changes prompt

UI or UX
UI + UX - Dirty-editor decision prompt before closing, canceling, switching, or replacing unsaved edits
UI guidance
Name the edited object, summarize what changed, and offer distinct Save changes, Discard changes, Review changes, and Keep editing choices when the system can support them.
UX guidance
Use an unsaved changes prompt to protect local edits at the moment a user is about to abandon or replace them inside the product.
Good UI
A profile editor close button opens Save changes to Billing contact?, lists edited phone and department fields, and offers Keep editing, Review changes, Save changes, or Discard changes.
Bad UI
A tab switch silently replaces the dirty editor with a different record and loses the user's typed notes.
Good UX
A user edits two fields, clicks Close, reviews the changed fields in the prompt, saves, and the editor closes only after the saved state is confirmed.
Bad UX
A user chooses Save, the request fails, and the editor still closes as though the latest values were safe.
Best fit
A close, cancel, switch, or edit-mode exit would discard unsaved local changes.
Avoid when
Every latest change is already saved or safely recoverable.
Required state
Dirty editor state with changed-field tracking.
Accessibility burden
Use dialog or alertdialog semantics when the prompt interrupts the current task and requires a response.
Common misuse
Prompting when nothing changed.

Exit warning

UI or UX
UI + UX - Attempted-departure safeguard for unrecoverable in-progress work
UI guidance
Show a warning only when the user attempts to leave with real unsaved, pending, failed, or unrecoverable work; place in-app route warnings at the point of departure with Save and leave, Discard and leave, and Stay editing choices.
UX guidance
Help the person reach a clear task outcome.
Good UI
A grant form user clicks Back with two unsaved answers; a dialog names the changed section and offers Save and leave, Discard and leave, or Stay editing.
Bad UI
Every navigation shows Are you sure you want to leave? even after the form is saved.
Good UX
A user chooses Discard and leave from an in-app warning and is taken to the intended destination with a clear understanding of what was discarded.
Bad UX
A user clicks a sidebar link after typing a long answer and loses it because the product only watched final Submit.
Best fit
A route change, tab close, reload, browser Back, external link, or sign-out action can interrupt a task.
Avoid when
The page is clean, read-only, or all changes are safely saved and recoverable.
Required state
Dirty unsaved state with local unsaved-work status.
Accessibility burden
Use a real dialog or alertdialog for in-app warnings, with a heading that names the loss risk.
Common misuse
Warning on every navigation regardless of whether work is dirty.

Autosave form

UI or UX
UI + UX - Background-saving form progress
UI guidance
Render a clear autosave message before users start, then keep a persistent status surface for Pending, Saving, Saved with timestamp, Failed, Retry, and unsafe-to-leave states.
UX guidance
Use autosave when losing progress would hurt and background persistence is safer than making users hunt for a distant Save button.
Good UI
A long application step says the application is saved on every change, shows Saving after an edited title blurs, then shows Draft saved just now with a timestamp.
Bad UI
A green Saved toast appears after one field saves, while another changed field is still pending or failed.
Good UX
A user writes a long answer, pauses, sees Saving, then sees Draft saved just now and can leave knowing the draft is recoverable.
Bad UX
A password or permission field autosaves immediately and takes effect before the user reviewed the consequence.
Best fit
Users spend meaningful time entering form content or application progress.
Avoid when
The form is short enough that a visible manual Save or Submit is clearer.
Required state
Initial state that explains progress will be saved automatically.
Accessibility burden
Expose autosave status changes in a polite status region so assistive technology users hear Saving, Saved, and Failed states.
Common misuse
Showing Saved when only an older change was saved.

Confirmation dialog

UI or UX
UI + UX - Consequential alert decision
UI guidance
Render an alert-style modal decision with a specific title, consequence description, safe cancellation, and a destructive action label that names the object or scope.
UX guidance
Help the person reach a clear task outcome.
Good UI
Delete Research archive? explains that 14 notes and shared links will be permanently removed, offers Keep archive, and labels the danger action Delete archive.
Bad UI
The red destructive action is enabled immediately and sits where users expect the routine primary button.
Good UX
Cancel, Escape, and Keep archive leave the archive unchanged and return focus to Delete archive.
Bad UX
Every archive, filter, and dismiss action opens the same confirmation until users click through automatically.
Best fit
The action is destructive, irreversible, costly, security-sensitive, privacy-affecting, or externally visible.
Avoid when
The action is routine and easily reversible.
Required state
Pre-action state with an explicit consequential trigger.
Accessibility burden
Use alertdialog semantics or platform equivalent when the decision is urgent and requires a response.
Common misuse
Asking users to confirm every routine action until they stop reading.
Decision rules
  • Use unsaved changes prompt when a user tries to close an editor, cancel edit mode, switch records, change tabs, or replace content while the current edit buffer has unsaved local changes.
  • Use exit warning when the risky trigger is page departure, browser reload or close, external navigation, route change, Back, or sign out rather than a focused editor-level close or switch.
  • Use autosave form when the main solution is continuous background progress persistence and the interface can prove the latest edits are saved or safely retryable before the user leaves.
  • Use confirmation dialog when the user invoked a consequential command such as Delete, Cancel application, Send, Publish, or Discard draft; dirty edit-buffer protection is only one specialized confirmation use case.
  • An unsaved changes prompt must identify the edited object or fields and separate Save changes, Discard changes, Review changes, and Keep editing where those outcomes are available.
  • Do not use an unsaved changes prompt for clean editors, read-only views, or durable drafts that can be resumed without data loss.
  • If Save changes fails, the unsaved changes prompt should keep the editor open with values intact; exit warnings and confirmations should not pretend that a failed save completed.
  • If the same dirty editor is at risk from both record switching and browser close, use the prompt for in-product switch or close decisions and a conditional beforeunload or exit-warning path for browser-controlled departure.
  • If autosave is pending or failed, state that condition in the prompt and prevent closing until save succeeds, retry is chosen, or the user explicitly discards.
  • Use Review changes when users may not remember what they edited or when discarding could remove several fields, but do not expose old or private values beyond the user's permission.
Inspect live examples
Failure modes
  • A dirty editor switches to another record without naming or preserving unsaved field values.
  • A prompt says Are you sure? with OK and Cancel, forcing users to infer whether OK saves, discards, or leaves.
  • The editor closes immediately after Save even though the save request is still pending or failed.
  • The app shows the same prompt on every close even when the record is already clean.
  • A route-level exit warning is reused for a small inline edit and names the wrong destination.
  • Autosave says Saved while the prompt still appears because dirty state was not cleared after the latest successful save.

Saved items