An alert dialog differs from a modal dialog

Alerts are functionally similar to a modal dialog. The primary difference is that an alert may not have a dedicated close button, and require people to take a specific action to dismiss (ex: Are you sure you want to delete your account? Yes / No).

Variations

(Spoiler alert: These all have the same rules.)

Dialog alert using JS (Do NOT use Popover API)

<button id="showModal">
  Delete my account
</button>

<dialog role="dialog"
        id="modal"
        tabindex="-1"
        aria-modal="true"
        aria-labelledby="dialog-title">
 
  <div class="dialog-content">
    <h2 id="dialog-title" class="h-bravo">
      Delete my account
    </h2>

    <p>
      Are you sure you want to permanently delete your account? This cannot be undone.
    </p>

    <button type="button"
      id="closeModal"
      class="menu">
        No, go back
    </button>

    <button type="button"
      class="menu danger">
        Yes, delete my account
    </button>
  </section>
</dialog>

Delete my account

Are you sure you want to permanently delete your account? This cannot be undone.

Related dialog alert entries