Most WordPress and WooCommerce sites still load an entire modal library, sometimes 20-40KB of JavaScript, just to show a cookie-consent banner or a newsletter popup. The browser has shipped a native way to do this since March 2022, and it now covers roughly 96% of global users: the HTML element, which handles the backdrop, focus trapping, and keyboard behavior a plugin would otherwise reimplement in JavaScript.
Browser Capabilities for Modals
A element opened with its showModal() method gets several things for free that a hand-built or plugin-built modal usually has to fake: a backdrop layer via the ::backdrop pseudo-element, automatic focus placed inside the dialog when it opens, the rest of the page becoming unclickable and unselectable while the dialog is open, and the Escape key closing it without any JavaScript listener required. As CSS-Tricks documents, calling show() instead lacks the backdrop, positioning, and closing stuff (treating it more like a pop-up than a modal), but showModal() is what most cart popups, quick-view product modals, and consent banners need.
Closing works three ways: the close() method called from JavaScript, the Escape key automatically for modal dialogs, or a fully declarative approach using

