HTML 5.2 has introduced a new element for native modal dialog boxes. At first glance, it seems fairly straightforward (and it is), but as I’ve been playing around with it, I’ve found it has some nice features that might be easy to miss.
[…]
JavaScript has a few methods and properties to make working with the element easy. The two methods you will probably need the most are showModal() and close().
[…]