Confirm in a Dialog
Write the code, see it run, pass the checks.
The problem
- medium
- Code
The page shows "Draft: Hello" and a "Discard draft" button. The button opens a dialog (an element with role="dialog", rendered only while it's open) asking "Discard this draft?" with "Cancel" and "Discard" buttons. Cancel closes it and keeps the draft; Discard closes it and changes the text to "Draft discarded". Pressing Escape closes it like Cancel.
Your code must pass
- Discard draft opens the dialog
- Cancel closes it and keeps the draft
- Discard closes it and discards the draft
- Escape closes it