feat(desktop): make PR smart chips copy the full URL on text selection

The visible chip label (icon + owner/repo#number) is marked
user-select:none while a hidden zero-width span holds the full URL
for clipboard copy. Adds an e2e test verifying the DOM structure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Taylor Ho
2026-04-08 14:14:34 -10:00
parent d4043920a4
commit a3784fc00a
2 changed files with 32 additions and 3 deletions

View File

@@ -52,13 +52,16 @@ function createMarkdownComponents(
return (
<a
{...props}
className="inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-sm font-medium text-primary no-underline transition-colors hover:bg-primary/20"
className="relative inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-sm font-medium text-primary no-underline transition-colors hover:bg-primary/20"
href={href}
rel="noreferrer"
target="_blank"
>
<GitPullRequest className="size-3.5" />
{owner}/{repo}#{number}
<span className="pointer-events-none select-none inline-flex items-center gap-1" aria-hidden="true">
<GitPullRequest className="size-3.5" />
{owner}/{repo}#{number}
</span>
<span className="absolute w-0 overflow-hidden whitespace-nowrap">{href}</span>
</a>
);
}