Estimated reading time : 3 min · Published October 7, 2026
Justify the interruption
Define what the person must decide and why they cannot continue without it. Reserve confirmation for consequences that deserve a real check. Repeated dialogs for easily reversible actions slow work and may make important confirmations less noticeable.
Use a title that identifies the object and explicit actions. For an attachment, “Remove document” is clearer than “OK”. Explain whether removal deletes the file permanently or only removes it from the displayed folder. Preserve previous input when the person cancels.
Plan focus and a way out
The W3C dialog pattern describes moving focus inside on opening, keeping Tab navigation within the dialog and returning focus logically afterwards. A visible close control and Escape provide a way out. Do not mark a window modal while its background remains interactive.
The HTML dialog element opened with showModal() makes the rest of the document inert. It does not choose the wording, initial focus or saving rules. Test the integrated dialog, including a case where deletion removes its original trigger.
Handle long content and delayed operations
On small screens, the title and close control must remain reachable. Check scrolling and whether a phone keyboard obscures the active field. If substantial reading is necessary, compare a dedicated page rather than layering several dialogs.
Separate waiting from success when an operation reaches a remote service. Failure should preserve enough context for recovery. Closing the interface does not prove a server operation was cancelled. Define the actual behaviour and avoid promising cancellation the service cannot perform.
Example: remove a document from a folder
Educational example: “Remove quote.pdf from this folder?” identifies the document and says the original file is retained. Cancellation changes nothing. After removal, confirmation describes the result and focus reaches a nearby list control. The test covers failure and a missing original trigger using test documents.
Reference documents
Content updated on October 7, 2026
