Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(docs): wrap and truncate long doc titles cleanly (MUL-9816) (#11161)

Jiayuan Zhang86cc57694da7
diff --git a/packages/views/docs/components/doc-history-page.tsx b/packages/views/docs/components/doc-history-page.tsx
index 5af61057d6..6a0b32c2ea 100644
--- a/packages/views/docs/components/doc-history-page.tsx
+++ b/packages/views/docs/components/doc-history-page.tsx
@@ -69,9 +69,10 @@ function DocHistoryPageContent({ docId }: { docId: string }) {
{
href: p.docDetail(docId),
label: doc.data?.title || t(($) => $.untitled),
+ className: "min-w-0 max-w-72 truncate",
},
]}
- leaf={t(($) => $.history.title)}
+ leaf={<span className="shrink-0">{t(($) => $.history.title)}</span>}
/>
<div className="flex min-h-0 flex-1 flex-col md:flex-row">
<div className="max-h-52 shrink-0 overflow-auto border-b p-3 md:max-h-none md:w-60 md:border-r md:border-b-0">
@@ -124,13 +125,14 @@ function DocHistoryPageContent({ docId }: { docId: string }) {
</Button>
) : version.data ? (
<>
- <div className="mb-6 flex items-center justify-between gap-3">
- <h1 className="text-display-sm font-semibold">
+ <div className="mb-6 flex items-start justify-between gap-3">
+ <h1 className="min-w-0 flex-1 text-display-sm font-semibold leading-snug wrap-anywhere">
{version.data.title || t(($) => $.untitled)}
</h1>
<Button
variant="outline"
size="sm"
+ className="shrink-0"
disabled={
update.isPending ||
!doc.data ||
diff --git a/packages/views/docs/components/doc-mention-card.tsx b/packages/views/docs/components/doc-mention-card.tsx
index e8e936ddd4..a1fe5e4ffe 100644
--- a/packages/views/docs/components/doc-mention-card.tsx
+++ b/packages/views/docs/components/doc-mention-card.tsx
@@ -40,7 +40,7 @@ export function DocMentionCard({
<AppLink
href={p.docDetail(docId)}
newTabTitle={title}
- className="doc-mention inline-flex"
+ className="doc-mention inline-flex max-w-full"
>
<span className="doc-chip mx-0.5 inline-flex min-w-0 max-w-[min(18rem,100%)] items-center gap-1.5 rounded-md border px-2 py-0.5 text-caption">
<FileText className="size-3.5 shrink-0 text-muted-foreground" />
diff --git a/packages/views/docs/components/doc-page.tsx b/packages/views/docs/components/doc-page.tsx
index c9c65faf1a..b35527b21d 100644
--- a/packages/views/docs/components/doc-page.tsx
+++ b/packages/views/docs/components/doc-page.tsx
@@ -14,6 +14,7 @@ import { copyText } from "@multica/ui/lib/clipboard";
import { cn } from "@multica/ui/lib/utils";
import { Button } from "@multica/ui/components/ui/button";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
+import { TruncatedTooltip } from "@multica/ui/components/common/truncated-tooltip";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import {
Tooltip,
@@ -40,6 +41,7 @@ import { useWorkspaceId } from "@multica/core/hooks";
import { useWS } from "@multica/core/realtime";
import { useWorkspacePaths } from "@multica/core/paths";
import { useActorName } from "@multica/core/workspace/hooks";
+import { isImeComposing } from "@multica/core/utils";
import type { Doc } from "@multica/core/types";
import { ContentEditor, ReadonlyContent, useEditorUpload } from "../../editor";
import { ActorAvatar } from "../../common/actor-avatar";
@@ -126,6 +128,66 @@ function DocPageContent({ docId }: { docId: string }) {
return <DocEditor key={`${wsId}:${docId}`} doc={query.data} />;
}
+const DOC_TITLE_CLASS = "text-display-sm font-semibold leading-snug wrap-anywhere";
+const BREADCRUMB_FOLDER_CLASS = "min-w-0 max-w-48 truncate";
+
+/**
+ * Single-paragraph title input that wraps and grows with its text instead of
+ * clipping inside a single line. Uses a CSS grid pseudo-element mirror so the
+ * height matches the wrapped text on first paint and across resizes without
+ * extra DOM text nodes.
+ */
+function DocTitleInput({
+ value,
+ placeholder,
+ ariaLabel,
+ autoFocus,
+ onChange,
+ onBlur,
+}: {
+ value: string;
+ placeholder: string;
+ ariaLabel: string;
+ autoFocus?: boolean;
+ onChange: (value: string) => void;
+ onBlur?: () => void;
+}) {
+ return (
+ <div
+ data-replicated-value={value || placeholder}
+ className={cn(
+ "grid whitespace-pre-wrap",
+ DOC_TITLE_CLASS,
+ "after:invisible after:pointer-events-none after:col-start-1 after:row-start-1 after:min-w-0 after:content-[attr(data-replicated-value)]",
+ )}
+ >
+ <textarea
+ aria-label={ariaLabel}
+ rows={1}
+ value={value}
+ autoFocus={autoFocus}
+ maxLength={300}
+ placeholder={placeholder}
+ onKeyDown={(e) => {
+ if (
+ (e.key === "Enter" || e.key === "Escape") &&
+ !isImeComposing(e.nativeEvent)
+ ) {
+ e.preventDefault();
+ e.currentTarget.blur();
+ }
+ }}
+ onChange={(e) => onChange(e.target.value.replace(/[\r\n]+/g, " "))}
+ onBlur={onBlur}
+ className={cn(
+ "col-start-1 row-start-1 h-full min-w-0 w-full resize-none overflow-hidden border-0 bg-transparent p-0 whitespace-pre-wrap outline-none placeholder:text-muted-foreground",
+ DOC_TITLE_CLASS,
+ )}
+ />
+ </div>
+ );
+}
+
/**
* The editor's frame while the doc loads: the header and reading column sit
* where the loaded page puts them, so nothing moves when the content lands.
@@ -149,11 +211,15 @@ function DocPageSkeleton({
<BreadcrumbHeader
segments={[
{ href: p.docs(), label: t(($) => $.kb) },
- ...ancestors.map((f) => ({ href: p.docFolder(f.id), label: f.title })),
+ ...ancestors.map((f) => ({
+ href: p.docFolder(f.id),
+ label: f.title,
+ className: BREADCRUMB_FOLDER_CLASS,
+ })),
]}
leaf={
summary ? (
- <span className="truncate">{summary.title || t(($) => $.untitled)}</span>
+ <span className="min-w-0 truncate">{summary.title || t(($) => $.untitled)}</span>
) : (
<Skeleton className="h-4 w-32" />
)
@@ -164,7 +230,7 @@ function DocPageSkeleton({
{children ?? (
<>
{summary ? (
- <div className="text-display-sm font-semibold">
+ <div className={DOC_TITLE_CLASS}>
{summary.title || (
<span className="text-muted-foreground">{t(($) => $.untitled)}</span>
)}
@@ -300,6 +366,8 @@ function DocEditor({ doc }: { doc: Doc }) {
setCommentsOpen(true);
}
};
+ const titleValue = solo ? draft.title : liveTitle.value;
+ const headerTitle = titleValue.trim() || t(($) => $.untitled);
return (
<div className="flex h-full min-h-0 flex-col">
<BreadcrumbHeader
@@ -308,10 +376,13 @@ function DocEditor({ doc }: { doc: Doc }) {
...ancestors.map((f) => ({
href: p.docFolder(f.id),
label: f.title,
+ className: BREADCRUMB_FOLDER_CLASS,
})),
]}
leaf={
- <span className="truncate">{doc.title || t(($) => $.untitled)}</span>
+ <TruncatedTooltip content={headerTitle} side="bottom" focusable>
+ <span className="min-w-0 truncate">{headerTitle}</span>
+ </TruncatedTooltip>
}
actions={
<>
@@ -427,18 +498,16 @@ function DocEditor({ doc }: { doc: Doc }) {
/>
</details>
)}
- <input
- aria-label={t(($) => $.editor.title_label)}
- value={solo ? draft.title : liveTitle.value}
+ <DocTitleInput
+ ariaLabel={t(($) => $.editor.title_label)}
+ value={titleValue}
// A doc just created from the tree is blank: start in its title.
autoFocus={!doc.title && !doc.content}
- maxLength={300}
placeholder={t(($) => $.untitled)}
- onChange={(e) =>
- solo ? change({ title: e.target.value }) : liveTitle.change(e.target.value)
+ onChange={(title) =>
+ solo ? change({ title }) : liveTitle.change(title)
}
onBlur={solo ? undefined : liveTitle.blur}
- className="w-full bg-transparent text-display-sm font-semibold outline-none"
/>
<div className="mt-3 mb-8 flex items-center gap-2 text-caption text-muted-foreground">
<ActorAvatar
diff --git a/packages/views/docs/components/doc-title-layout.test.tsx b/packages/views/docs/components/doc-title-layout.test.tsx
new file mode 100644
index 0000000000..515744f990
--- /dev/null
+++ b/packages/views/docs/components/doc-title-layout.test.tsx
@@ -0,0 +1,284 @@
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { I18nProvider } from "@multica/core/i18n/react";
+import { configStore } from "@multica/core/config";
+import { docKeys, useDocDraftStore } from "@multica/core/docs";
+import { DOCS_V1_FLAG } from "@multica/core/feature-flags";
+import type { Doc } from "@multica/core/types";
+import { DocPage } from "./doc-page";
+import { DocHistoryPage } from "./doc-history-page";
+import { DocsHomePage } from "./docs-home-page";
+import { MoveDialog } from "./move-dialog";
+import enDocs from "../../locales/en/docs.json";
+import enEditor from "../../locales/en/editor.json";
+import enIssues from "../../locales/en/issues.json";
+
+const apiMock = vi.hoisted(() => ({
+ getDoc: vi.fn(),
+ updateDoc: vi.fn(),
+ listDocTree: vi.fn(),
+ listDocVersions: vi.fn(),
+ getDocVersion: vi.fn(),
+ listDocComments: vi.fn(),
+ listMembers: vi.fn(),
+ listAgents: vi.fn(),
+}));
+vi.mock("@multica/core/api", () => ({
+ api: apiMock,
+ ApiError: class extends Error {},
+}));
+vi.mock("@multica/core/hooks", async (original) => ({
+ ...(await original<object>()),
+ useWorkspaceId: () => "ws",
+}));
+vi.mock("@multica/core/platform", async (original) => ({
+ ...(await original<object>()),
+ getCurrentWsId: () => "ws",
+}));
+vi.mock("@multica/core/auth", () => ({
+ useAuthStore: Object.assign(vi.fn(), {
+ getState: () => ({ user: { id: "me" } }),
+ }),
+}));
+vi.mock("@multica/core/paths", async (original) => ({
+ ...(await original<object>()),
+ useWorkspacePaths: () => ({
+ docs: () => "/ws/docs",
+ docDetail: (id: string) => `/ws/docs/${id}`,
+ docFolder: (id: string) => `/ws/docs/folders/${id}`,
+ docHistory: (id: string) => `/ws/docs/${id}/history`,
+ }),
+}));
+vi.mock("@multica/core/workspace/hooks", () => ({
+ useActorName: () => ({ getActorName: () => "Me" }),
+}));
+vi.mock("../../navigation", () => ({
+ useNavigation: () => ({
+ pathname: "/ws/docs/long-doc",
+ push: vi.fn(),
+ getShareableUrl: (path: string) => path,
+ searchParams: new URLSearchParams(),
+ }),
+ AppLink: ({
+ children,
+ href,
+ className,
+ }: {
+ children: React.ReactNode;
+ href: string;
+ className?: string;
+ }) => (
+ <a href={href} className={className}>
+ {children}
+ </a>
+ ),
+}));
+vi.mock("../../editor", () => ({
+ ContentEditor: ({
+ value,
+ onUpdate,
+ }: {
+ value: string;
+ onUpdate: (value: string) => void;
+ }) => (
+ <textarea
+ aria-label="Body"
+ value={value}
+ onChange={(event) => onUpdate(event.target.value)}
+ />
+ ),
+ ReadonlyContent: ({ content }: { content: string }) => <div>{content}</div>,
+ useEditorUpload: () => ({ uploadWithToast: vi.fn() }),
+}));
+vi.mock("./use-doc-collab", () => ({
+ useDocCollab: () => ({ mode: "solo" }),
+}));
+vi.mock("@multica/core/realtime", () => ({
+ useWS: () => ({ collabUrl: "ws://collab.test/collab" }),
+}));
+vi.mock("./doc-live-session", () => ({
+ liveEditingOff: new Set(["ws://collab.test/collab"]),
+ peekDocLive: () => undefined,
+ findDocSession: () => undefined,
+ prefetchDocLive: () => Promise.resolve({ enabled: false }),
+}));
+vi.mock("./use-prefetch-doc", () => ({
+ usePrefetchDoc: () => () => ({}),
+ useWarmDocPage: () => undefined,
+}));
+vi.mock("../../common/actor-avatar", () => ({ ActorAvatar: () => null }));
+
+const LONG_TITLE =
+ "Multica 2026 Q4 跨团队知识库架构设计方案与实时协作编辑系统迁移路线图(含多端离线同步与权限模型评审记录)";
+const LONG_FOLDER_TITLE =
+ "产品研发与基础设施架构设计文档归档目录(2026 年度跨团队协作规范)";
+
+const doc: Doc = {
+ id: "long-doc",
+ workspaceId: "ws",
+ folderId: "long-folder",
+ title: LONG_TITLE,
+ content: "Body text",
+ revision: 1,
+ versionCount: 1,
+ createdByType: "member",
+ createdById: "me",
+ updatedByType: "member",
+ updatedById: "me",
+ createdAt: "2026-11-21T00:00:00Z",
+ updatedAt: "2026-11-21T00:00:00Z",
+};
+
+const tree = {
+ folders: [
+ {
+ id: "long-folder",
+ workspaceId: "ws",
+ parentId: null,
+ title: LONG_FOLDER_TITLE,
+ createdByType: "member" as const,
+ createdById: "me",
+ createdAt: "2026-11-21T00:00:00Z",
+ updatedAt: "2026-11-21T00:00:00Z",
+ },
+ ],
+ docs: [doc],
+};
+
+let qc: QueryClient;
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ configStore.getState().setFeatureFlags({ [DOCS_V1_FLAG]: true });
+ useDocDraftStore.getState().clearDraft();
+ qc = new QueryClient({
+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
+ });
+ apiMock.getDoc.mockResolvedValue(doc);
+ apiMock.listDocTree.mockResolvedValue(tree);
+ apiMock.listDocComments.mockResolvedValue([]);
+ apiMock.listMembers.mockResolvedValue([]);
+ apiMock.listAgents.mockResolvedValue([]);
+ apiMock.listDocVersions.mockResolvedValue([
+ {
+ number: 1,
+ authorType: "member",
+ authorId: "me",
+ contributors: [],
+ message: "",
+ updatedAt: "2026-11-21T00:00:00Z",
+ },
+ ]);
+ apiMock.getDocVersion.mockResolvedValue({
+ number: 1,
+ title: LONG_TITLE,
+ content: "Body text",
+ updatedAt: "2026-11-21T00:00:00Z",
+ });
+});
+
+afterEach(() => {
+ cleanup();
+ qc.clear();
+});
+
+function mount(children: React.ReactNode) {
+ return render(
+ <QueryClientProvider client={qc}>
+ <I18nProvider
+ locale="en"
+ resources={{ en: { docs: enDocs, editor: enEditor, issues: enIssues } }}
+ >
+ {children}
+ </I18nProvider>
+ </QueryClientProvider>,
+ );
+}
+
+it("renders the doc title as an auto-wrapping textarea that strips pasted newlines and blurs on Enter", async () => {
+ mount(<DocPage docId="long-doc" />);
+
+ const title = (await screen.findByRole("textbox", {
+ name: "Title",
+ })) as HTMLTextAreaElement;
+ expect(title.tagName).toBe("TEXTAREA");
+ expect(title.maxLength).toBe(300);
+ expect(title.value).toBe(LONG_TITLE);
+ expect(title.parentElement?.getAttribute("data-replicated-value")).toBe(
+ LONG_TITLE,
+ );
+
+ // Pasted multi-line text is flattened to a single paragraph.
+ fireEvent.change(title, { target: { value: "Line 1\n\nLine 2" } });
+ expect(title.value).toBe("Line 1 Line 2");
+ expect(title.parentElement?.getAttribute("data-replicated-value")).toBe(
+ "Line 1 Line 2",
+ );
+
+ // Enter while composing (IME) must not blur; plain Enter blurs without inserting a newline.
+ title.focus();
+ fireEvent.keyDown(title, { key: "Enter", isComposing: true });
+ expect(document.activeElement).toBe(title);
+
+ fireEvent.keyDown(title, { key: "Enter" });
+ expect(document.activeElement).not.toBe(title);
+
+ // Breadcrumb ancestor folder segment truncates instead of staying shrink-0.
+ const folderLink = screen.getByRole("link", { name: LONG_FOLDER_TITLE });
+ expect(folderLink.className).toContain("truncate");
+ expect(folderLink.className).toContain("min-w-0");
+});
+
+it("truncates the doc breadcrumb segment and wraps the heading on DocHistoryPage", async () => {
+ mount(<DocHistoryPage docId="long-doc" />);
+
+ const heading = await screen.findByRole("heading", { level: 1 });
+ expect(heading.textContent).toBe(LONG_TITLE);
+ expect(heading.className).toContain("min-w-0");
+ expect(heading.className).toContain("wrap-anywhere");
+
+ const docCrumb = screen.getByRole("link", { name: LONG_TITLE });
+ expect(docCrumb.className).toContain("truncate");
+ expect(docCrumb.className).toContain("min-w-0");
+
+ const restoreBtn = screen.getByRole("button", { name: "Restore this version" });
+ expect(restoreBtn.className).toContain("shrink-0");
+});
+
+it("constrains MoveDialog header and listbox width for long titles", () => {
+ qc.setQueryData(docKeys.tree("ws"), tree);
+ mount(
+ <MoveDialog
+ target={{ kind: "doc", id: "long-doc", title: LONG_TITLE }}
+ onOpenChange={vi.fn()}
+ />,
+ );
+
+ const title = screen.getByRole("heading", {
+ name: `Move "${LONG_TITLE}"`,
+ });
+ expect(title.className).toContain("truncate");
+ expect(title.className).toContain("min-w-0");
+ expect(title.parentElement?.className).toContain("min-w-0");
+ expect(title.parentElement?.className).toContain("pr-8");
+
+ const listbox = screen.getByRole("listbox");
+ expect(listbox.className).toContain("min-w-0");
+});
+
+it("truncates long folder headers and keeps list row icons un-squished on DocsHomePage", async () => {
+ qc.setQueryData(docKeys.tree("ws"), tree);
+ mount(<DocsHomePage folderId="long-folder" />);
+
+ const headerHeading = await screen.findByRole("heading", {
+ level: 1,
+ name: LONG_FOLDER_TITLE,
+ });
+ expect(headerHeading.className).toContain("truncate");
+ expect(headerHeading.className).toContain("min-w-0");
+
+ const docLink = screen.getByRole("link", { name: LONG_TITLE });
+ const icon = docLink.querySelector("svg");
+ expect(icon?.getAttribute("class")).toContain("shrink-0");
+});
diff --git a/packages/views/docs/components/doc-tree.tsx b/packages/views/docs/components/doc-tree.tsx
index 069b7da3e1..0960258675 100644
--- a/packages/views/docs/components/doc-tree.tsx
+++ b/packages/views/docs/components/doc-tree.tsx
@@ -12,6 +12,7 @@ import {
Trash2,
} from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { TruncatedTooltip } from "@multica/ui/components/common/truncated-tooltip";
import { Input } from "@multica/ui/components/ui/input";
import {
Dialog,
@@ -371,7 +372,9 @@ export function DocTree() {
className={`group flex cursor-pointer items-center gap-1 rounded-md px-1 py-1 text-body hover:bg-surface-hover ${dropTarget === folder.id ? "bg-surface-hover ring-1 ring-ring" : ""}`}
>
<Folder className="size-4 shrink-0 text-muted-foreground" />
- <span className="min-w-0 flex-1 truncate">{folder.title}</span>
+ <TruncatedTooltip content={folder.title} side="right">
+ <span className="min-w-0 flex-1 truncate">{folder.title}</span>
+ </TruncatedTooltip>
<Button
variant="ghost"
size="icon-xs"
@@ -405,13 +408,15 @@ export function DocTree() {
className={`flex items-center gap-1 rounded-md px-1 py-1 text-body ${pathname === p.docDetail(doc.id) ? "bg-surface-selected text-surface-selected-foreground" : "hover:bg-surface-hover"}`}
>
<FileText className="size-4 shrink-0 text-muted-foreground" />
- <AppLink
- href={p.docDetail(doc.id)}
- {...prefetchDoc(doc.id)}
- className="min-w-0 flex-1 truncate"
- >
- {doc.title || t(($) => $.untitled)}
- </AppLink>
+ <TruncatedTooltip content={doc.title || t(($) => $.untitled)} side="right">
+ <AppLink
+ href={p.docDetail(doc.id)}
+ {...prefetchDoc(doc.id)}
+ className="min-w-0 flex-1 truncate"
+ >
+ {doc.title || t(($) => $.untitled)}
+ </AppLink>
+ </TruncatedTooltip>
{menu({ kind: "doc", item: doc })}
</li>
))}
diff --git a/packages/views/docs/components/docs-home-page.tsx b/packages/views/docs/components/docs-home-page.tsx
index fd258afe36..3a019010a0 100644
--- a/packages/views/docs/components/docs-home-page.tsx
+++ b/packages/views/docs/components/docs-home-page.tsx
@@ -5,6 +5,7 @@ import { useWorkspacePaths } from "@multica/core/paths";
import { docTreeOptions } from "@multica/core/docs";
import { FileText, Folder } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { TruncatedTooltip } from "@multica/ui/components/common/truncated-tooltip";
import { PageHeader } from "../../layout/page-header";
import { AppLink } from "../../navigation";
import { useT } from "../../i18n";
@@ -32,14 +33,17 @@ function DocsHomePageContent({ folderId }: { folderId: string | null }) {
tree.data?.folders.filter((f) => f.parentId === folderId) ?? [];
const docs = tree.data?.docs.filter((d) => d.folderId === folderId) ?? [];
useWarmDocPage(docs[0]?.id ?? tree.data?.docs[0]?.id);
+ const headerTitle = folderId
+ ? tree.data?.folders.find((f) => f.id === folderId)?.title
+ : t(($) => $.kb);
return (
<div className="flex h-full min-h-0 flex-col">
<PageHeader>
- <h1 className="text-body font-medium">
- {folderId
- ? tree.data?.folders.find((f) => f.id === folderId)?.title
- : t(($) => $.kb)}
- </h1>
+ <TruncatedTooltip content={headerTitle} side="bottom" focusable>
+ <h1 className="min-w-0 truncate text-body font-medium">
+ {headerTitle}
+ </h1>
+ </TruncatedTooltip>
</PageHeader>
<div className="min-h-0 flex-1 overflow-auto p-6">
<div className="mx-auto max-w-3xl">
@@ -57,29 +61,34 @@ function DocsHomePageContent({ folderId }: { folderId: string | null }) {
<ul>
{folders.map((f) => (
<li key={f.id}>
- <AppLink
- href={p.docFolder(f.id)}
- className="flex items-center gap-3 rounded-md p-3 text-body hover:bg-surface-hover"
- >
- <Folder className="size-4" />
- <span className="truncate">{f.title}</span>
- </AppLink>
- </li>
- ))}
- {docs.map((d) => (
- <li key={d.id}>
- <AppLink
- href={p.docDetail(d.id)}
- {...prefetchDoc(d.id)}
- className="flex items-center gap-3 rounded-md p-3 text-body hover:bg-surface-hover"
- >
- <FileText className="size-4" />
- <span className="truncate">
- {d.title || t(($) => $.untitled)}
- </span>
- </AppLink>
+ <TruncatedTooltip content={f.title}>
+ <AppLink
+ href={p.docFolder(f.id)}
+ className="flex items-center gap-3 rounded-md p-3 text-body hover:bg-surface-hover"
+ >
+ <Folder className="size-4 shrink-0" />
+ <span className="min-w-0 truncate">{f.title}</span>
+ </AppLink>
+ </TruncatedTooltip>
</li>
))}
+ {docs.map((d) => {
+ const title = d.title || t(($) => $.untitled);
+ return (
+ <li key={d.id}>
+ <TruncatedTooltip content={title}>
+ <AppLink
+ href={p.docDetail(d.id)}
+ {...prefetchDoc(d.id)}
+ className="flex items-center gap-3 rounded-md p-3 text-body hover:bg-surface-hover"
+ >
+ <FileText className="size-4 shrink-0" />
+ <span className="min-w-0 truncate">{title}</span>
+ </AppLink>
+ </TruncatedTooltip>
+ </li>
+ );
+ })}
</ul>
)}
</div>
diff --git a/packages/views/docs/components/move-dialog.tsx b/packages/views/docs/components/move-dialog.tsx
index a16dbb1442..58d323db69 100644
--- a/packages/views/docs/components/move-dialog.tsx
+++ b/packages/views/docs/components/move-dialog.tsx
@@ -129,7 +129,7 @@ export function MoveDialog({
: "hover:bg-surface-hover",
)}
>
- <span className="text-muted-foreground [&_svg]:size-4">{icon}</span>
+ <span className="shrink-0 text-muted-foreground [&_svg]:size-4">{icon}</span>
<span className="min-w-0 flex-1 truncate">{label}</span>
{id === current && (
<span className="shrink-0 text-caption text-faint-foreground">
@@ -146,15 +146,15 @@ export function MoveDialog({
onOpenChange={(open) => (open ? onOpenChange(true) : close())}
>
<DialogContent className="sm:max-w-md">
- <DialogHeader>
- <DialogTitle className="truncate">
+ <DialogHeader className="min-w-0 pr-8">
+ <DialogTitle className="min-w-0 truncate">
{t(($) => $.move.title, { title: target?.title ?? "" })}
</DialogTitle>
</DialogHeader>
<div
role="listbox"
aria-label={t(($) => $.move.destination)}
- className="max-h-80 overflow-y-auto"
+ className="max-h-80 min-w-0 overflow-y-auto"
>
{option(
null,