Say hello
The classic: a short message and one way out. This is the original version of the project.
Native <dialog> · Vanilla JS · 0 libraries
A small study of the modal window: the box that pops up on top of a page, waits for your answer and then politely disappears. It closes with Esc, the × button or a click outside.
The classic: a short message and one way out. This is the original version of the project.
A confirm dialog with two choices. Focus starts on the safe button.
A modal with a real form, a label and validation. Nothing is sent anywhere.
dialog.showModal() puts the window on top, keeps the focus inside it and makes Esc close it.
If the click lands on the dialog itself and not on its content, it was on the dark backdrop, so we close.
The window grows from 92% to 100% and fades in. Only transform and opacity move, so it stays smooth.