Copy-to-clipboard buttons: an accessibility checklist

Practical UI pattern notes for teams. No tracking.
Why this matters

“Copy” is a high-frequency action. When the feedback is only a toast that isn’t announced, or when the control isn’t keyboard-operable, people lose confidence and repeat the action (often copying the wrong thing).

Checklist

Minimal example

This is intentionally small and pattern-focused. Adapt it to your design system.

<label for="invite">Invite code</label>
<input id="invite" value="RIVER-INDIGO-7H2Q" readonly>

<button type="button" id="copy" aria-describedby="copyStatus">
  Copy invite code
</button>

<span id="copyStatus" role="status" aria-live="polite" aria-atomic="true"></span>

<script>
  const input = document.getElementById('invite');
  const status = document.getElementById('copyStatus');

  document.getElementById('copy').addEventListener('click', async () => {
    status.textContent = '';
    try {
      await navigator.clipboard.writeText(input.value);
      status.textContent = 'Copied.';
    } catch {
      status.textContent = 'Copy failed. Select the value and copy manually.';
    }
  });
</script>

Keyboard reminder: Tab to the button; activate with Space/Enter.

Common pitfalls