Opens modally with a backdrop, traps focus, returns it on close.
returnValue
property
The value of the key that closed it.
close · cancel
event
After it closes; cancel on Escape.
Escape
keyboard
Closes it, as native.
Usage notes
Open it. Escape or “Keep it” closes it; focus returns to the key.
Accessibility
Put the flat key first, so the safe choice is reached first.
Keyboard: Escape closes a modal dialog, and Tab and Shift+Tab stay on what is inside it, because the page behind is inert. Enter or Space presses the focused key.