a11y-dialog is a lightweight (1.5Kb) yet flexible script to create accessible dialog windows.
✔︎ Leveraging the native
<dialog> element if desired
✔︎ Closing dialog on overlay click and ESC
✔︎ Trapping and restoring focus
✔︎ Firing events
✔︎ DOM and JS APIs
✔︎ Fast and tiny
You can try the live demo on CodeSandbox.
Originally, this repository was a fork from accessible-modal-dialog by Greg Kraus. It has gone through various stages since the initial implementation and both packages are no longer similar in the way they work.