Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix: add keyboard navigation, aria-label, and error handling to heading anchors
Sushmithamallesh999adfa22151
diff --git a/docs/components/heading.tsx b/docs/components/heading.tsxindex a64f6a1a5..c6a1992f0 100644--- a/docs/components/heading.tsx+++ b/docs/components/heading.tsx@@ -29,19 +29,37 @@ export function Heading({ as, className, ...props }: HeadingProps) {function HeadingAnchor({ id, children }: { id: string; children: React.ReactNode }) {const [copied, setCopied] = useState(false);- const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {- e.preventDefault();+ const copyLink = () => {const url = `${window.location.origin}${window.location.pathname}${window.location.search}#${id}`;window.history.replaceState(null, '', `#${id}`);navigator.clipboard.writeText(url).then(() => {setCopied(true);setTimeout(() => setCopied(false), 2000);- });+ }).catch(() => {});+ };++ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {+ e.preventDefault();+ copyLink();+ };++ const handleKeyDown = (e: React.KeyboardEvent<HTMLAnchorElement>) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ copyLink();+ }};return (<>- <a data-card="" href={`#${id}`} className="peer" onClick={handleClick}>+ <a+ data-card=""+ href={`#${id}`}+ className="peer"+ onClick={handleClick}+ onKeyDown={handleKeyDown}+ aria-label={`Copy link to ${id} section`}+ >{children}</a>{copied ? (