Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8651 fix(sidebar): reveal clipped project and issue titles on hover and focus (#9991)
SUBARUAWA4864dd9df8b9d4f
diff --git a/packages/views/layout/panels/sidebar-tree.test.tsx b/packages/views/layout/panels/sidebar-tree.test.tsxindex 7924fa932f..5c324d08d2 100644--- a/packages/views/layout/panels/sidebar-tree.test.tsx+++ b/packages/views/layout/panels/sidebar-tree.test.tsx@@ -1,6 +1,6 @@import { cloneElement, type ReactNode } from "react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import { fireEvent, screen } from "@testing-library/react";+import { act, fireEvent, screen, waitFor } from "@testing-library/react";import { describe, expect, it, vi } from "vitest";import { agentTaskSnapshotOptions } from "@multica/core/agents";import { buildIssueStatusCatalog } from "@multica/core/issue-statuses/queries";@@ -9,7 +9,7 @@ import { issueUnreadOptions } from "@multica/core/issues/unread";import type { AgentTask, Issue, IssueUnread, ListIssuesParams } from "@multica/core/types";import { renderWithI18n } from "../../test/i18n";import { IssueContextMenuProvider } from "../../issues/actions";-import { SidebarIssueList } from "./sidebar-tree";+import { SidebarIssueList, TreeRow } from "./sidebar-tree";vi.mock("../../issues/actions/issue-actions-menu-items", () => ({contextPrimitives: {},@@ -203,3 +203,42 @@ describe("SidebarIssueList", () => {expect(updateField).toHaveBeenCalledWith({ status: "done" });});});++// jsdom does not lay out the sidebar: model clipping at the existing label.+function clipLabel(el: HTMLElement) {+ el.style.overflowX = "hidden";+ Object.defineProperties(el, {+ scrollWidth: { configurable: true, value: 320 },+ clientWidth: { configurable: true, value: 100 },+ });+}++describe("sidebar title disclosure", () => {+ it("reveals a clipped project title on keyboard focus without replacing the link", async () => {+ const label = "A project title longer than the sidebar";+ renderWithI18n(<TreeRow href="/acme/projects/p1" label={label} icon={<span />} active={false} />);+ const link = screen.getByRole("link", { name: label });+ clipLabel(link);+ await act(async () => link.focus());+ expect(document.querySelector("[data-slot=tooltip-content]")).toHaveTextContent(label);+ expect(screen.getByRole("link", { name: label })).toBe(link);+ expect(link).toHaveAttribute("href", "/acme/projects/p1");+ await act(async () => link.blur());+ await waitFor(() => expect(document.querySelector("[data-slot=tooltip-content]")).toBeNull());+ });++ it("reveals a clipped issue title after hover while retaining its navigation target", async () => {+ renderList();+ const link = screen.getByRole("link", { name: "Issue 1" });+ clipLabel(screen.getByText("Issue 1"));+ vi.useFakeTimers();+ try {+ fireEvent.pointerEnter(link, { pointerType: "mouse" });+ await act(async () => { vi.advanceTimersByTime(550); });+ } finally {+ vi.useRealTimers();+ }+ expect(document.querySelector("[data-slot=tooltip-content]")).toHaveTextContent("Issue 1");+ expect(link).toHaveAttribute("href", "/acme/issues/issue-1");+ });+});diff --git a/packages/views/layout/panels/sidebar-tree.tsx b/packages/views/layout/panels/sidebar-tree.tsxindex 84a17db808..ee7c0a0210 100644--- a/packages/views/layout/panels/sidebar-tree.tsx+++ b/packages/views/layout/panels/sidebar-tree.tsx@@ -4,6 +4,7 @@ import { forwardRef, memo, useCallback, useLayoutEffect, useState } from "react"import { keepPreviousData, useQuery } from "@tanstack/react-query";import { ChevronDown, ChevronRight, ChevronUp } from "@multica/ui/icons";import { cn } from "@multica/ui/lib/utils";+import { TruncatedTooltip } from "@multica/ui/components/common/truncated-tooltip";import { ShimmerText } from "@multica/ui/components/common/shimmer-text";import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip";import { agentTaskSnapshotOptions } from "@multica/core/agents";@@ -135,19 +136,21 @@ export const TreeRow = forwardRef<HTMLAnchorElement, TreeRowProps>(function Tree) : (icon)}- <AppLink- ref={linkRef}- href={href}- newTabTitle={label}- draggable={false}- aria-current={active ? "page" : undefined}- onKeyDown={onKeyDown}- onClick={onNavigate}- onNavigateInPlace={onNavigateInPlace}- className="min-w-0 flex-1 truncate outline-none after:absolute after:inset-0 after:rounded-lg focus-visible:after:outline-2 focus-visible:after:outline-ring"- >- {label}- </AppLink>+ <TruncatedTooltip content={label}>+ <AppLink+ ref={linkRef}+ href={href}+ newTabTitle={label}+ draggable={false}+ aria-current={active ? "page" : undefined}+ onKeyDown={onKeyDown}+ onClick={onNavigate}+ onNavigateInPlace={onNavigateInPlace}+ className="min-w-0 flex-1 truncate outline-none after:absolute after:inset-0 after:rounded-lg focus-visible:after:outline-2 focus-visible:after:outline-ring"+ >+ {label}+ </AppLink>+ </TruncatedTooltip>{trailing}</div>);@@ -494,21 +497,23 @@ const SidebarIssueRow = memo(function SidebarIssueRow({label={statusLabel}className="size-3"/>- <AppLink- href={unreadIssueHref(href, unread)}- newTabTitle={issue.title}- aria-current={active ? "page" : undefined}- onKeyDown={onKeyDown}- className={ISSUE_ROW_LINK_CLASS}- >- <ShimmerText- active={!!agents?.running}- className={cn("min-w-0 flex-1 truncate", SIDEBAR_SHIMMER_CLASS, !agents && unread && "text-foreground")}+ <TruncatedTooltip content={issue.title}>+ <AppLink+ href={unreadIssueHref(href, unread)}+ newTabTitle={issue.title}+ aria-current={active ? "page" : undefined}+ onKeyDown={onKeyDown}+ className={ISSUE_ROW_LINK_CLASS}>- {issue.title}- </ShimmerText>- {agents ? <IssueAgentBadge agents={agents} /> : unread && <IssueUnreadDot unread={unread} />}- </AppLink>+ <ShimmerText+ active={!!agents?.running}+ className={cn("min-w-0 flex-1 truncate", SIDEBAR_SHIMMER_CLASS, !agents && unread && "text-foreground")}+ >+ {issue.title}+ </ShimmerText>+ {agents ? <IssueAgentBadge agents={agents} /> : unread && <IssueUnreadDot unread={unread} />}+ </AppLink>+ </TruncatedTooltip></div></IssueActionsContextMenu>);