@devries-cameron20 / t3code-1 / commits / 9b0387d6cd
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): triple-click selects the whole line around links and file chips (#32334)

Julius Marminge committed Nov 12, 2026 at 16:14 UTC 9b0387d6cd574517a3209dd97b7eb88b26c3b5ca
3 files changed +58 -5
apps/web/src/components/ChatMarkdown.browser.test.tsx
+36
@@ -579,6 +579,42 @@ describe("ChatMarkdown inline code selection", () => {
579 await userEvent.dblClick(fenced, { position: { x: 4, y: 4 } });
580 expect(window.getSelection()?.toString()).toBe("fenced");
581 });
582 +
583 + it("selects the whole line on triple-click beside a favicon link or a file chip", async () => {
584 + setup();
585 + await using screen = await renderText(
586 + "Before [docs](https://example.com/docs) after words\n\nBefore [App.tsx](/tmp/project/src/App.tsx) after words",
587 + );
588 + const tripleClickWord = async (paragraph: HTMLElement, word: string) => {
589 + const text = [...paragraph.childNodes].find((node) => node.textContent?.includes(word))!;
590 + const range = document.createRange();
591 + range.setStart(text, text.textContent!.indexOf(word));
592 + range.setEnd(text, text.textContent!.indexOf(word) + word.length);
593 + const wordBox = range.getBoundingClientRect();
594 + const paragraphBox = paragraph.getBoundingClientRect();
595 + window.getSelection()?.removeAllRanges();
596 + await userEvent.tripleClick(paragraph, {
597 + position: {
598 + x: wordBox.left - paragraphBox.left + wordBox.width / 2,
599 + y: wordBox.top - paragraphBox.top + wordBox.height / 2,
600 + },
601 + });
602 + return window.getSelection()?.toString().trim();
603 + };
604 +
605 + const paragraphs = screen.container.querySelectorAll("p");
606 + expect(paragraphs).toHaveLength(2);
607 + const selections = [];
608 + const lines = [];
609 + for (const paragraph of paragraphs) {
610 + lines.push(paragraph.textContent?.trim(), paragraph.textContent?.trim());
611 + selections.push(
612 + await tripleClickWord(paragraph, "Before"),
613 + await tripleClickWord(paragraph, "after"),
614 + );
615 + }
616 + expect(selections).toEqual(lines);
617 + });
618 });
619
620 describe("ChatMarkdown file chip tooltips", () => {
apps/web/src/components/chat/MarkdownExternalLink.tsx
+3 -5
@@ -7,7 +7,8 @@ import { sourceControlClients } from "@t3tools/client-runtime/source-control-cli
7 import { cn } from "../../lib/utils";
8 import { sourceControlIcon } from "../../sourceControlPresentation";
9
10 -const MARKDOWN_LINK_FAVICON_CLASS_NAME = "block size-full shrink-0 select-none";
10 +// Inline-level and selectable: triple-click selection stops at block-level and select-none boxes.
11 +const MARKDOWN_LINK_FAVICON_CLASS_NAME = "inline-block size-[14px] [vertical-align:-0.125em]";
12
13 const failedFaviconHosts = new Set<string>();
14
@@ -23,10 +24,7 @@ const MarkdownLinkFavicon = memo(function MarkdownLinkFavicon({ host }: { host:
24 const brandIcon = sourceControlHostIcon(host);
25 const faviconUrl = brandIcon ? null : faviconUrlForOrigin(`https://${host}`);
26 return (
26 - <span
27 - className="ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]"
28 - aria-hidden
29 - >
27 + <span className="ms-[0.25em] me-[0.2em]" aria-hidden>
28 {brandIcon ? (
29 brandIcon
30 ) : faviconUrl === null || failedHost === host || failedFaviconHosts.has(host) ? (
apps/web/src/index.css
+19
@@ -2039,6 +2039,25 @@ code {
2039 text-decoration: none;
2040 }
2041
2042 +/* Triple-click selection stops at block-level boxes, flex items included, so file chips in
2043 + prose stay inline-level down to the icon and label. */
2044 +.chat-markdown-file-link {
2045 + display: inline-block;
2046 + overflow-x: clip;
2047 + text-overflow: ellipsis;
2048 + white-space: nowrap;
2049 +}
2050 +
2051 +.chat-markdown-file-link > :is(svg, img) {
2052 + display: inline;
2053 + margin-inline-end: 0.2em;
2054 + vertical-align: -0.125em;
2055 +}
2056 +
2057 +.chat-markdown-file-link > [data-slot="context-chip-label"] {
2058 + display: inline;
2059 +}
2060 +
2061 /* File links and context chips own their color and focus ring. */
2062 .chat-markdown a:not(.chat-markdown-file-link, :has([data-slot="context-chip-label"])) {
2063 color: var(--info-foreground);