Modal dialog component (closed by default)

This example demonstrates an accessible modal/dialog. The modal is closed initially. Click the button below to open it. The button that opens the modal has the class "trigger".

Focus is trapped inside the modal while it's open. Press Escape to close, or click outside the dialog. When the modal closes, focus will return to the trigger.