Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 04:30 UTC
docs: fix Radix tab ID leak in copied prompt — use aria-labelledby to find trigger text
The tab panel's data-value contains Radix internal IDs like "radix _r_1k_ trigger python". Instead, look up the tab trigger element via aria-labelledby to get the clean label ("Python"). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmitha Mallesh committed
Mar 6, 2026 at 23:56 UTC
6ebdcb34eeaf890090524656099602faea9df920
1 file changed
+9
-5
docs/components/quickstart/prompt-banner.tsx
+9
-5
@@ -43,12 +43,16 @@ export function PromptBanner({ children }: PromptBannerProps) {
43
const code = pre.querySelector('code')?.textContent?.trim() ?? '';
44
if (!code) return;
45
46
- // Check if inside a tab panel — use tab name as label
46
+ // Check if inside a tab panel — find the matching tab trigger for the label
47
const tabPanel = pre.closest('[role="tabpanel"]');
48
- const tabId = tabPanel?.getAttribute('data-value') ?? tabPanel?.getAttribute('aria-labelledby');
49
- if (tabId) {
50
- const label = tabId.replace(/-/g, ' ');
51
- parts.push(`**${label}**\n\n\`\`\`${lang}\n${code}\n\`\`\``);
48
+ let tabLabel = '';
49
+ if (tabPanel) {
50
+ const labelledBy = tabPanel.getAttribute('aria-labelledby') ?? '';
51
+ const trigger = labelledBy ? document.getElementById(labelledBy) : null;
52
+ tabLabel = trigger?.textContent?.trim() ?? '';
53
+ }
54
+ if (tabLabel) {
55
+ parts.push(`**${tabLabel}**\n\n\`\`\`${lang}\n${code}\n\`\`\``);
56
} else {
57
parts.push(`\`\`\`${lang}\n${code}\n\`\`\``);
58
}