@devries-cameron20 / composio-1 / commits / 999adfa22
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: add keyboard navigation, aria-label, and error handling to heading anchors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmithamallesh committed Feb 9, 2026 at 16:43 UTC 999adfa22151bd671c6afb16255c9d82f5d6177b
1 file changed +22 -4
docs/components/heading.tsx
+22 -4
@@ -29,19 +29,37 @@ export function Heading({ as, className, ...props }: HeadingProps) {
29 function HeadingAnchor({ id, children }: { id: string; children: React.ReactNode }) {
30 const [copied, setCopied] = useState(false);
31
32 - const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
33 - e.preventDefault();
32 + const copyLink = () => {
33 const url = `${window.location.origin}${window.location.pathname}${window.location.search}#${id}`;
34 window.history.replaceState(null, '', `#${id}`);
35 navigator.clipboard.writeText(url).then(() => {
36 setCopied(true);
37 setTimeout(() => setCopied(false), 2000);
39 - });
38 + }).catch(() => {});
39 + };
40 +
41 + const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
42 + e.preventDefault();
43 + copyLink();
44 + };
45 +
46 + const handleKeyDown = (e: React.KeyboardEvent<HTMLAnchorElement>) => {
47 + if (e.key === 'Enter' || e.key === ' ') {
48 + e.preventDefault();
49 + copyLink();
50 + }
51 };
52
53 return (
54 <>
44 - <a data-card="" href={`#${id}`} className="peer" onClick={handleClick}>
55 + <a
56 + data-card=""
57 + href={`#${id}`}
58 + className="peer"
59 + onClick={handleClick}
60 + onKeyDown={handleKeyDown}
61 + aria-label={`Copy link to ${id} section`}
62 + >
63 {children}
64 </a>
65 {copied ? (