Building a modal from scratch means writing the same boilerplate every time: a <div> with role="dialog" , an aria-modal attribute, a tabindex="-1" to steal focus, a keydown listener to catch Escape, a focus-trap library to keep Tab cycling inside the dialog, and a click listener on the backdrop overlay you rendered yourself. It works, but you're doing the browser's job. The <dialog> element exists to take that job back. The baseline API <dialo...