What you need to know
A dialog should announce its purpose, keep keyboard users inside its controls while modal, and return them to the control that opened it. A visual overlay alone does not provide these behaviors.
How to apply it
Prefer the native dialog element or a well-tested accessible library. Give it a clear name, move focus into it on open, support Escape where appropriate, and restore focus on close.
Common mistake to avoid
Do not put a dialog behind the overlay in the tab order. Verify focus with a keyboard and screen reader rather than relying on appearance.
