Skip to content

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

docs: fix Radix tab ID leak in copied prompt — use aria-labelledby to find trigger text

Sushmitha Mallesh6ebdcb34eeaf
diff --git a/docs/components/quickstart/prompt-banner.tsx b/docs/components/quickstart/prompt-banner.tsx
index 39977cef6..a13ce72c2 100644
--- a/docs/components/quickstart/prompt-banner.tsx
+++ b/docs/components/quickstart/prompt-banner.tsx
@@ -43,12 +43,16 @@ export function PromptBanner({ children }: PromptBannerProps) {
const code = pre.querySelector('code')?.textContent?.trim() ?? '';
if (!code) return;
- // Check if inside a tab panel — use tab name as label
+ // Check if inside a tab panel — find the matching tab trigger for the label
const tabPanel = pre.closest('[role="tabpanel"]');
- const tabId = tabPanel?.getAttribute('data-value') ?? tabPanel?.getAttribute('aria-labelledby');
- if (tabId) {
- const label = tabId.replace(/-/g, ' ');
- parts.push(`**${label}**\n\n\`\`\`${lang}\n${code}\n\`\`\``);
+ let tabLabel = '';
+ if (tabPanel) {
+ const labelledBy = tabPanel.getAttribute('aria-labelledby') ?? '';
+ const trigger = labelledBy ? document.getElementById(labelledBy) : null;
+ tabLabel = trigger?.textContent?.trim() ?? '';
+ }
+ if (tabLabel) {
+ parts.push(`**${tabLabel}**\n\n\`\`\`${lang}\n${code}\n\`\`\``);
} else {
parts.push(`\`\`\`${lang}\n${code}\n\`\`\``);
}