CodingLaboratory
Lab Commands
Enter The Lab

Component Lab / feedback-overlays / accessible-modal

Stable release
Back to category

Open experiment

Accessible confirmation modal

A confirmation modal that opens from a real button, isolates keyboard focus, closes on Escape or backdrop click, and explains the destructive outcome.

Lab tested Responsive Dark mode Interactive
Version
1.0.0
Updated
2026-08-02
Dependencies
Zero
Live canvasInstant token updates
Source filesEditable and export-ready
<div class="cmp-modal">
  <button class="cmp-modal__open" type="button">Delete experiment</button>
  <dialog aria-labelledby="cmp-modal-title" aria-describedby="cmp-modal-description">
    <form method="dialog">
      <div class="cmp-modal__mark" aria-hidden="true">!</div>
      <h2 id="cmp-modal-title">Delete this experiment?</h2>
      <p id="cmp-modal-description">
        This removes the local draft and its edit history. Export a copy first if you may need it
        later.
      </p>
      <div class="cmp-modal__actions">
        <button value="cancel">Keep experiment</button
        ><button class="cmp-modal__confirm" value="delete">Delete permanently</button>
      </div>
    </form>
  </dialog>
  <p class="cmp-modal__status" role="status" aria-live="polite"></p>
</div>
No runtime reactions detected Open in Editor

Validated in the lab

Experiment report

  • Schema and source files passed
  • Responsive test passed
  • Keyboard test passed
  • No console errors

Component ingredients

Dependencies
None
Browser support
Current Chrome, Current Edge, Current Firefox, Current Safari
Version
1.0.0
Last tested
2026-08-02

Accessibility notes

  • Uses the native dialog element.
  • Cancel receives initial focus.
  • Escape and close restore focus.

License: MIT License for open-source use, modification, and distribution.