Forms ask before you lose unsaved changes
The design system has a shared guard for forms with unsaved changes. With
useUnsavedChangesGuard, closing the tab, clicking a link to another page or pressing Back
asks first: Save, Discard or Cancel. See
Unsaved changes.
- Opt-in. Screens in the web app keep their current behaviour; the design-system gallery's Forms page-form uses the guard so you can try it.
- Clean forms never ask. Nothing is registered until the form is dirty.
- For contributors. Pass
dirty, andonSave/onDiscardwhen the form has them; render the returneddialogand pass itsdirtytoFormFrame. UseconfirmLeavefor a move the screen makes itself.
