Skip to main content

Curbcut WCAG AAA

Dialog

A modal built on the native dialog element.

Delete draft?

This removes the draft. The published page is not affected.

Show the markup
<button class="cc-button" type="button" data-cc-dialog-open="ex-dialog">Delete this draft</button>
<dialog class="cc-dialog" id="ex-dialog" aria-labelledby="ex-dialog-title">
  <div class="cc-dialog__header">
    <h2 id="ex-dialog-title" class="cc-heading cc-heading--md" style="margin:0">Delete draft?</h2>
    <button class="cc-button cc-button--secondary cc-button--sm" type="button" data-cc-dialog-close aria-label="Close">✕</button>
  </div>
  <div class="cc-dialog__body">
    <p class="cc-paragraph">This removes the draft. The published page is not affected.</p>
  </div>
  <div class="cc-dialog__footer">
    <button class="cc-button cc-button--secondary" type="button" data-cc-dialog-close>Cancel</button>
    <button class="cc-button cc-button--danger" type="button" data-cc-dialog-close>Delete draft</button>
  </div>
</dialog>

Accessibility

  • Native <dialog>.showModal(): focus trapping, Esc to close, backdrop and focus restoration come from the platform.
  • Labeled by its heading; the close button has an accessible name.
  • Modals interrupt — reserve them for confirmations that genuinely block. Prefer a page for anything with more than a couple of fields.