A modal that traps focus. Zero JavaScript libraries.
The native dialog element now handles focus, Escape and the backdrop for you. Here is the five-line version that replaces the 40KB one.
const dialog = document.querySelector("dialog");
openButton.addEventListener("click", () => {
dialog.showModal(); // focus trap + Esc, built in
});