Skip to content

Commit 7875604

Browse files
fix(web): file chip tooltips show the whole path (pingdotgg#27993)
Co-authored-by: Yash Singh <[email protected]>
1 parent 9c0baf4 commit 7875604

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎apps/web/src/components/ChatMarkdown.browser.test.tsx‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,26 @@ describe("ChatMarkdown inline code selection", () => {
433433
});
434434
});
435435

436+
describe("ChatMarkdown file chip tooltips", () => {
437+
it("wraps a long path so its file name stays inside the tooltip", async () => {
438+
setup();
439+
const path =
440+
"/tmp/project/packages/client-runtime/src/state/generated/environment-connection-handshake-retry-policy-fixtures.ts";
441+
await using screen = await renderText(`See [the fixtures](${path}).`);
442+
443+
await userEvent.hover(screen.container.querySelector(".chat-markdown-file-link")!);
444+
const tooltip = page.getByText(path);
445+
await expect.element(tooltip).toBeVisible();
446+
447+
const popup = tooltip.element().closest("[data-side]")!;
448+
const pathEnd = document.createRange();
449+
pathEnd.selectNodeContents(tooltip.element());
450+
expect(pathEnd.getBoundingClientRect().right).toBeLessThanOrEqual(
451+
popup.getBoundingClientRect().right,
452+
);
453+
});
454+
});
455+
436456
describe("ChatMarkdown editor deep links", () => {
437457
const hrefs = (container: HTMLElement) =>
438458
[...container.querySelectorAll("a")].map((link) => link.getAttribute("href"));

‎apps/web/src/components/chat/MarkdownFileLink.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({
379379
}
380380
/>
381381
<TooltipPopup side="top" variant="code">
382-
<div className="overflow-x-auto whitespace-nowrap scrollbar-thumb-border/78 scrollbar-track-transparent [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border/78 [&::-webkit-scrollbar-track]:bg-transparent">
383-
<WorkspaceEntryTooltip path={iconPath} label={targetPath} environmentId={environmentId} />
384-
</div>
382+
<WorkspaceEntryTooltip path={iconPath} label={targetPath} environmentId={environmentId} />
385383
</TooltipPopup>
386384
</Tooltip>
387385
);

0 commit comments

Comments
 (0)