From 435204f86d3515f6a78431ece70c03f4682cb045 Mon Sep 17 00:00:00 2001 From: Prince Yadav Date: Sat, 31 Oct 2026 11:42:25 +0530 Subject: [PATCH] fix(web): file chip tooltips show the whole path The file chip tooltip kept the path on one line inside a scroll box, but the tooltip ignores the pointer, so long paths were cut off at its max width. Let the code tooltip variant wrap the path instead. --- .../components/ChatMarkdown.browser.test.tsx | 20 +++++++++++++++++++ .../src/components/chat/MarkdownFileLink.tsx | 4 +--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/ChatMarkdown.browser.test.tsx b/apps/web/src/components/ChatMarkdown.browser.test.tsx index e4dfceefd91da..8bac589924bae 100644 --- a/apps/web/src/components/ChatMarkdown.browser.test.tsx +++ b/apps/web/src/components/ChatMarkdown.browser.test.tsx @@ -385,6 +385,26 @@ describe("ChatMarkdown inline code selection", () => { }); }); +describe("ChatMarkdown file chip tooltips", () => { + it("wraps a long path so its file name stays inside the tooltip", async () => { + setup(); + const path = + "/tmp/project/packages/client-runtime/src/state/generated/environment-connection-handshake-retry-policy-fixtures.ts"; + await using screen = await renderText(`See [the fixtures](${path}).`); + + await userEvent.hover(screen.container.querySelector(".chat-markdown-file-link")!); + const tooltip = page.getByText(path); + await expect.element(tooltip).toBeVisible(); + + const popup = tooltip.element().closest("[data-side]")!; + const pathEnd = document.createRange(); + pathEnd.selectNodeContents(tooltip.element()); + expect(pathEnd.getBoundingClientRect().right).toBeLessThanOrEqual( + popup.getBoundingClientRect().right, + ); + }); +}); + describe("ChatMarkdown Windows file links", () => { const environmentId = EnvironmentId.make("env-windows"); const renderWindows = (text: string, parseRawHtml: boolean) => diff --git a/apps/web/src/components/chat/MarkdownFileLink.tsx b/apps/web/src/components/chat/MarkdownFileLink.tsx index 6a250f93d2157..a816760202979 100644 --- a/apps/web/src/components/chat/MarkdownFileLink.tsx +++ b/apps/web/src/components/chat/MarkdownFileLink.tsx @@ -379,9 +379,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({ } /> -
- -
+
);