Modal & Dialog
Overlays for confirmations, quick-create forms, and full dialogs. All modals are focus-trapped,
close on Esc, and use role="dialog" with aria-modal="true".
Destructive confirm buttons use coral — confirm labels restate the action.
Live demos
Confirmation dialog — destructive
This will permanently delete PO-0042 and all its order lines. Approved receipts linked to this order will not be deleted. This action cannot be undone.
Confirmation dialog — warning
Resetting to draft will remove the confirmation number and allow changes. Any receipts already validated will remain unchanged.
Quick-create form
Full form modal
Behavior reference
| Behavior | Rule | Implementation |
|---|---|---|
| Open animation | Fade + scale up from 97% → 100% | CSS transition on .is-open |
| Close on Esc | Always | keydown listener, remove .is-open |
| Close on backdrop | For non-destructive forms only | Click on .modal-backdrop, not .modal |
| Focus trap | Tab cycles within modal | Query all focusable, wrap at boundary |
| Return focus | On close, return to trigger element | Store lastFocus before open |
| Scroll lock | Body scroll locked while open | overflow: hidden on body |
| Destructive label | Button must restate the action | "Delete purchase order" not "Confirm" |