Merge pull request #57969 from alelpoan/fix/copy-button-tooltip
Some checks are pending
CI / OSV scan (push) Waiting to run
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
CI / Detect affected areas (push) Successful in 18s
CI / Python tests (push) Waiting to run
CI / Python lints (push) Waiting to run
CI / TypeScript (push) Waiting to run
CI / Docs Site (push) Waiting to run
CI / Deny unrelated histories (push) Waiting to run
CI / Check contributors (push) Waiting to run
Deploy Site / deploy-vercel (push) Has been skipped
CI / Check uv.lock (push) Waiting to run
CI / Lint Docker scripts (push) Waiting to run
CI / Build&Test Docker image (push) Waiting to run
CI / Supply-chain scan (push) Waiting to run
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
Build Skills Index / trigger-deploy (push) Has been skipped

This commit is contained in:
brooklyn! 2026-07-03 18:52:56 -05:00 committed by GitHub
commit 5445e42b87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 14 deletions

View file

@ -486,10 +486,11 @@ function ToolEntry({ part }: ToolEntryProps) {
{copyAction.text && (
<CopyButton
appearance="inline"
className="absolute right-1.5 top-1.5 z-10 h-5 gap-0 rounded-md px-1 opacity-5 transition-opacity group-hover/tool-block:opacity-100 hover:opacity-100 focus-visible:opacity-100"
className="absolute right-4 top-1.5 z-10 h-5 gap-0 rounded-md px-1 opacity-5 transition-opacity group-hover/tool-block:opacity-100 hover:opacity-100 focus-visible:opacity-100"
iconClassName="size-3"
label={copyAction.label}
showLabel={false}
side="left"
stopPropagation
text={copyAction.text}
/>

View file

@ -49,6 +49,7 @@ export interface CopyButtonProps {
onCopyError?: (error: unknown) => void
preventDefault?: boolean
showLabel?: boolean
side?: React.ComponentProps<typeof Tip>['side']
stopPropagation?: boolean
text: CopyPayload
title?: string
@ -69,6 +70,7 @@ export function CopyButton({
onCopyError,
preventDefault = false,
showLabel,
side,
stopPropagation = false,
text,
title
@ -180,18 +182,20 @@ export function CopyButton({
if (appearance === 'inline') {
return (
<button
aria-label={ariaLabel}
className={cn(
'inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[0.75rem] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-40',
className
)}
disabled={disabled}
onClick={event => void copy(event)}
type="button"
>
{content}
</button>
<Tip label={feedbackLabel} side={side}>
<button
aria-label={ariaLabel}
className={cn(
'inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[0.75rem] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-40',
className
)}
disabled={disabled}
onClick={event => void copy(event)}
type="button"
>
{content}
</button>
</Tip>
)
}
@ -229,5 +233,5 @@ export function CopyButton({
)
// Only icon-only buttons need a tooltip; the text variant already shows its label.
return appearance === 'icon' ? <Tip label={feedbackLabel}>{button}</Tip> : button
return appearance === 'icon' ? <Tip label={feedbackLabel} side={side ?? 'bottom'}>{button}</Tip> : button
}