Explain the ‘dialog’ element and how it manages modals in HTML. element and how it manages modals in HTML.

<dialog> creates accessible, modal-like interfaces natively in HTML. The show() and close() methods control its visibility, and the open attribute makes it visible to users.

Example:

<dialog id="myDialog">This is a dialog</dialog>
<script>document.getElementById('myDialog').show();</script>