What the person is doing
The surface has editable values that can differ from the last saved record.
Application · lesson 9 of 23 · Error Prevention And Recovery
Underlying principle: Recovery begins before the error. Clear consequences, suitable constraints, preserved work, and a visible correction path reduce the cost of a mistake.
Track the dirty edit buffer, intercept abandonment or replacement actions, present a specific save-discard-stay decision with changed-field evidence, complete or fail saving before continuing, and clear the prompt only when the edit buffer is safe, intentionally discarded, or still preserved.
Recovery begins before the error. Clear consequences, suitable constraints, preserved work, and a visible correction path reduce the cost of a mistake.
The surface has editable values that can differ from the last saved record.
Track the dirty edit buffer, intercept abandonment or replacement actions, present a specific save-discard-stay decision with changed-field evidence, complete or fail saving before continuing, and clear the prompt only when the edit buffer is safe, intentionally discarded, or still preserved.
Dirty editor state with changed-field tracking.
What exact object or fields are dirty?
Keep editing closes the prompt, preserves all local values, and returns focus to the editor or triggering control.
The surface has editable values that can differ from the last saved record.
Open the working example, try its controls, and compare the behavior against the decision guidance.
The surface has editable values that can differ from the last saved record.
Track the dirty edit buffer, intercept abandonment or replacement actions, present a specific save-discard-stay decision with changed-field evidence, complete or fail saving before continuing, and clear the prompt only when the edit buffer is safe, intentionally discarded, or still preserved.
Dirty editor state with changed-field tracking.
A clean editor still prompts on close and trains users to ignore warnings.
Use dialog or alertdialog semantics when the prompt interrupts the current task and requires a response.
Mozilla - checked
MDN documents warning users about unsaved data loss and limiting listeners to actual unsaved-change conditions.
GitLab Pajamas Design System - checked
GitLab Pajamas documents save feedback, failed-save recovery, undo, and leave warnings for unsaved form changes.
Microsoft - checked
Microsoft confirmation guidance supports specific consequence information and avoiding unnecessary prompts.
W3C Web Accessibility Initiative - checked
APG alertdialog guidance covers modal interruptions that require a response.
Source trail checked: