Summary
Add a small “Copy” button to every code block (
) across documentation pages (including installation guides). The button copies the code to clipboard, gives immediate visual feedback (e.g. “Copied!”), is keyboard accessible, and works for dynamically rendered content (client-side navigation). Use progressive enhancement (works if JavaScript is enabled; if not, code remains readable).
Why
Improves developer DX: copying long commands / snippets is tedious without a one-click button.
Standard expectation for docs & reduces copy/paste errors.
Accessibility-friendly copy affordance helps keyboard & screen-reader users.
Proposed solution
Add a small Vue 2 client-side enhancement that:
Finds all
blocks and inserts a copy button.
Uses the modern Clipboard API with a robust fallback.
Shows visual feedback (tooltip text changes to “Copied!” then reverts).
Supports keyboard activation and has appropriate aria-* attributes.
Handles dynamically inserted code blocks (MutationObserver).
Minimal CSS to match docs styling.
Add a single small global CSS file for the copy button.
Add tests/manual checklist.