Skip to content

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

Go

MUL-8131: feat(ui): tooltips with shortcut hints and disabled reasons for icon buttons (#9398)

Jiayuan Zhange0e9efc5f1d6
diff --git a/apps/desktop/src/renderer/src/components/daemon-panel.tsx b/apps/desktop/src/renderer/src/components/daemon-panel.tsx
index 3a7e391cba..2214c6e048 100644
--- a/apps/desktop/src/renderer/src/components/daemon-panel.tsx
+++ b/apps/desktop/src/renderer/src/components/daemon-panel.tsx
@@ -19,6 +19,7 @@ import { truncateWithEllipsis } from "@multica/core/utils";
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
import { Button } from "@multica/ui/components/ui/button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
Dialog,
DialogContent,
@@ -257,14 +258,16 @@ export function DaemonPanel({
</DialogTitle>
<ContextBadge status={status} runtimeCount={runtimeCount} />
</div>
- <button
- type="button"
- onClick={() => onOpenChange(false)}
- aria-label={t(($) => $.desktop.daemon.close)}
- className="flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- >
- <X className="size-4" />
- </button>
+ <TooltipHint label={t(($) => $.desktop.daemon.close)} side="bottom">
+ <button
+ type="button"
+ onClick={() => onOpenChange(false)}
+ aria-label={t(($) => $.desktop.daemon.close)}
+ className="flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <X className="size-4" />
+ </button>
+ </TooltipHint>
</div>
{/* Toolbar */}
diff --git a/apps/desktop/src/renderer/src/components/tab-bar.tsx b/apps/desktop/src/renderer/src/components/tab-bar.tsx
index bcf8b5a1ee..444889781c 100644
--- a/apps/desktop/src/renderer/src/components/tab-bar.tsx
+++ b/apps/desktop/src/renderer/src/components/tab-bar.tsx
@@ -33,6 +33,7 @@ import {
ContextMenuSeparator,
ContextMenuTrigger,
} from "@multica/ui/components/ui/context-menu";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useScrollFade } from "@multica/ui/hooks/use-scroll-fade";
import { SIDEBAR_WRAPPER_FILL_CLASS } from "@multica/ui/components/ui/sidebar";
import { cn } from "@multica/ui/lib/utils";
@@ -293,7 +294,6 @@ function SortableTabItem({
aria-label={tabName}
data-tab-active={isActive ? "true" : undefined}
data-tab-entering={isEntering ? "true" : undefined}
- title={tab.pinned ? tabName : undefined}
style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
className={cn(
// The 36px frame contains a centered 32px content row and a 4px
@@ -397,7 +397,9 @@ function SortableTabItem({
/>
)}
<ContextMenu>
- <ContextMenuTrigger render={tabButton} />
+ <TooltipHint label={tab.pinned ? tabName : undefined} side="bottom">
+ <ContextMenuTrigger render={tabButton} />
+ </TooltipHint>
<ContextMenuContent>
{issueWindowPath && (
<>
@@ -535,16 +537,17 @@ function NewTabButton() {
};
return (
- <button
- type="button"
- onClick={handleClick}
- aria-label={newTabLabel}
- title={newTabLabel}
- style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
- className="flex size-7 shrink-0 items-center justify-center self-center rounded-md text-faint-foreground transition-colors hover:bg-muted/50 hover:text-muted-foreground"
- >
- <Plus className="size-3.5" />
- </button>
+ <TooltipHint label={newTabLabel} side="bottom">
+ <button
+ type="button"
+ onClick={handleClick}
+ aria-label={newTabLabel}
+ style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
+ className="flex size-7 shrink-0 items-center justify-center self-center rounded-md text-faint-foreground transition-colors hover:bg-muted/50 hover:text-muted-foreground"
+ >
+ <Plus className="size-3.5" />
+ </button>
+ </TooltipHint>
);
}
diff --git a/apps/desktop/src/renderer/src/components/window-toolbar.test.tsx b/apps/desktop/src/renderer/src/components/window-toolbar.test.tsx
index a1ab3c2f99..bcee6381b4 100644
--- a/apps/desktop/src/renderer/src/components/window-toolbar.test.tsx
+++ b/apps/desktop/src/renderer/src/components/window-toolbar.test.tsx
@@ -1,6 +1,8 @@
-import type { ComponentProps } from "react";
+import type { ComponentProps, ReactNode } from "react";
import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { I18nProvider } from "@multica/core/i18n/react";
+import { RESOURCES } from "@multica/views/locales";
const historyState = vi.hoisted(() => ({
canGoBack: true,
@@ -44,6 +46,14 @@ vi.mock("@multica/ui/components/ui/sidebar", () => ({
const { WINDOW_TOOLBAR_CLEARANCE, WindowToolbar, historyIndicesForMenu } =
await import("./window-toolbar");
+function I18nWrapper({ children }: { children: ReactNode }) {
+ return (
+ <I18nProvider locale="en" resources={RESOURCES}>
+ {children}
+ </I18nProvider>
+ );
+}
+
beforeEach(() => {
historyState.canGoBack = true;
historyState.canGoForward = true;
@@ -88,7 +98,7 @@ describe("historyIndicesForMenu", () => {
describe("WindowToolbar history controls", () => {
it("left-aligns the controls past the traffic lights across the expanded sidebar", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
const toolbar = document.querySelector('[data-slot="window-toolbar"]');
expect(toolbar).not.toHaveClass("justify-end");
@@ -102,7 +112,7 @@ describe("WindowToolbar history controls", () => {
});
it("keeps the controls clear of the traffic lights after toggling the sidebar", () => {
- const { rerender } = render(<WindowToolbar />);
+ const { rerender } = render(<WindowToolbar />, { wrapper: I18nWrapper });
sidebarState.state = "collapsed";
rerender(<WindowToolbar />);
@@ -112,7 +122,7 @@ describe("WindowToolbar history controls", () => {
});
it("orders Back, Forward, then the sidebar toggle with no separate History button", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
expect(
screen.getAllByRole("button").map((button) => button.getAttribute("aria-label")),
@@ -126,21 +136,21 @@ describe("WindowToolbar history controls", () => {
historyState.historyEntries = ["/acme/issues"];
historyState.historyIndex = 0;
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
expect(screen.getByRole("button", { name: "Go back" })).toBeDisabled();
expect(screen.getByRole("button", { name: "Go forward" })).toBeDisabled();
});
it("keeps a normal Back click as one-step navigation", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
fireEvent.click(screen.getByRole("button", { name: "Go back" }));
expect(historyState.goBack).toHaveBeenCalledOnce();
});
it("opens Back history on a sustained hold without also stepping back", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
const back = screen.getByRole("button", { name: "Go back" });
fireEvent.pointerDown(back, { button: 0, clientX: 20, clientY: 20 });
@@ -154,7 +164,7 @@ describe("WindowToolbar history controls", () => {
});
it("offers the same menu from ArrowDown for keyboard users", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
const forward = screen.getByRole("button", { name: "Go forward" });
fireEvent.keyDown(forward, { key: "ArrowDown" });
@@ -162,7 +172,7 @@ describe("WindowToolbar history controls", () => {
});
it("jumps to the selected Back history index", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
const back = screen.getByRole("button", { name: "Go back" });
fireEvent.keyDown(back, { key: "ArrowDown" });
@@ -174,7 +184,7 @@ describe("WindowToolbar history controls", () => {
});
it("restores focus to the toolbar button when its menu closes", () => {
- render(<WindowToolbar />);
+ render(<WindowToolbar />, { wrapper: I18nWrapper });
const forward = screen.getByRole("button", { name: "Go forward" });
forward.focus();
diff --git a/apps/desktop/src/renderer/src/components/window-toolbar.tsx b/apps/desktop/src/renderer/src/components/window-toolbar.tsx
index d08682021f..6fdd828d03 100644
--- a/apps/desktop/src/renderer/src/components/window-toolbar.tsx
+++ b/apps/desktop/src/renderer/src/components/window-toolbar.tsx
@@ -18,10 +18,17 @@ import {
DropdownMenuItem,
DropdownMenuLabel,
} from "@multica/ui/components/ui/dropdown-menu";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@multica/ui/components/ui/tooltip";
import {
ResourceLeadingVisual,
useTabPresentation,
} from "@multica/views/layout";
+import { ActionShortcutKeycaps } from "@multica/views/common/shortcut-keycaps";
+import { useT } from "@multica/views/i18n";
import { useTabHistory } from "@/hooks/use-tab-history";
import { browsingHistoryKeyForUrl } from "@/stores/tab-store";
@@ -168,6 +175,7 @@ function HistoryMenuItem({
}
export function WindowToolbar() {
+ const { t } = useT("layout");
const { state: sidebarState, isCompact } = useSidebar();
const sidebarHidden = sidebarState === "collapsed" || isCompact;
const toolbarWidth: React.CSSProperties["width"] = sidebarHidden
@@ -184,6 +192,7 @@ export function WindowToolbar() {
goToHistoryIndex,
} = useTabHistory();
const [menu, setMenu] = useState<OpenHistoryMenu | null>(null);
+ const [tooltip, setTooltip] = useState<HistoryMenuMode | null>(null);
const menuAnchorRef = useRef<HTMLElement | null>(null);
const menuContentRef = useRef<HTMLDivElement | null>(null);
@@ -230,7 +239,9 @@ export function WindowToolbar() {
[browsingHistory],
);
const menuLabel =
- menu?.mode === "forward" ? "Forward history" : "Back history";
+ menu?.mode === "forward"
+ ? t(($) => $.window.forward_history)
+ : t(($) => $.window.back_history);
const navButtonClassName =
"flex size-7 items-center justify-center rounded-md text-faint-foreground transition-colors duration-150 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-30 motion-reduce:transition-none";
@@ -259,72 +270,100 @@ export function WindowToolbar() {
className="flex items-center gap-2"
style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
>
- <button
- type="button"
- disabled={!canGoBack}
- aria-label="Go back"
- aria-haspopup="menu"
- aria-expanded={menu?.mode === "back"}
- title="Go back (press and hold for history)"
- className={navButtonClassName}
- onPointerDown={backPress.onPointerDown}
- onPointerMove={backPress.onPointerMove}
- onPointerUp={backPress.onPointerUp}
- onPointerCancel={backPress.onPointerCancel}
- onPointerLeave={backPress.onPointerLeave}
- onContextMenu={(event) => {
- event.preventDefault();
- openMenu("back", event.currentTarget);
- }}
- onKeyDown={(event) => {
- if (event.key !== "ArrowDown") return;
- event.preventDefault();
- openMenu("back", event.currentTarget);
- }}
- onClick={(event) => {
- if (backPress.consumeClick()) {
- event.preventDefault();
- return;
- }
- goBack();
- }}
+ <Tooltip
+ // Stays shut while a history menu is open over the same button.
+ open={tooltip === "back" && menu === null}
+ onOpenChange={(open) => setTooltip(open ? "back" : null)}
>
- <ArrowLeft aria-hidden className="size-4" />
- </button>
- <button
- type="button"
- disabled={!canGoForward}
- aria-label="Go forward"
- aria-haspopup="menu"
- aria-expanded={menu?.mode === "forward"}
- title="Go forward (press and hold for history)"
- className={navButtonClassName}
- onPointerDown={forwardPress.onPointerDown}
- onPointerMove={forwardPress.onPointerMove}
- onPointerUp={forwardPress.onPointerUp}
- onPointerCancel={forwardPress.onPointerCancel}
- onPointerLeave={forwardPress.onPointerLeave}
- onContextMenu={(event) => {
- event.preventDefault();
- openMenu("forward", event.currentTarget);
- }}
- onKeyDown={(event) => {
- if (event.key !== "ArrowDown") return;
- event.preventDefault();
- openMenu("forward", event.currentTarget);
- }}
- onClick={(event) => {
- if (forwardPress.consumeClick()) {
- event.preventDefault();
- return;
+ <TooltipTrigger
+ render={
+ <button
+ type="button"
+ disabled={!canGoBack}
+ aria-label={t(($) => $.window.go_back)}
+ aria-haspopup="menu"
+ aria-expanded={menu?.mode === "back"}
+ className={navButtonClassName}
+ onPointerDown={backPress.onPointerDown}
+ onPointerMove={backPress.onPointerMove}
+ onPointerUp={backPress.onPointerUp}
+ onPointerCancel={backPress.onPointerCancel}
+ onPointerLeave={backPress.onPointerLeave}
+ onContextMenu={(event) => {
+ event.preventDefault();
+ openMenu("back", event.currentTarget);
+ }}
+ onKeyDown={(event) => {
+ if (event.key !== "ArrowDown") return;
+ event.preventDefault();
+ openMenu("back", event.currentTarget);
+ }}
+ onClick={(event) => {
+ if (backPress.consumeClick()) {
+ event.preventDefault();
+ return;
+ }
+ goBack();
+ }}
+ >
+ <ArrowLeft aria-hidden className="size-4" />
+ </button>
}
- goForward();
- }}
+ />
+ <TooltipContent side="bottom">
+ {t(($) => $.window.go_back)}
+ <ActionShortcutKeycaps action="goBack" />
+ <span className="text-muted-foreground">{t(($) => $.window.hold_for_history)}</span>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip
+ open={tooltip === "forward" && menu === null}
+ onOpenChange={(open) => setTooltip(open ? "forward" : null)}
>
- <ArrowRight aria-hidden className="size-4" />
- </button>
+ <TooltipTrigger
+ render={
+ <button
+ type="button"
+ disabled={!canGoForward}
+ aria-label={t(($) => $.window.go_forward)}
+ aria-haspopup="menu"
+ aria-expanded={menu?.mode === "forward"}
+ className={navButtonClassName}
+ onPointerDown={forwardPress.onPointerDown}
+ onPointerMove={forwardPress.onPointerMove}
+ onPointerUp={forwardPress.onPointerUp}
+ onPointerCancel={forwardPress.onPointerCancel}
+ onPointerLeave={forwardPress.onPointerLeave}
+ onContextMenu={(event) => {
+ event.preventDefault();
+ openMenu("forward", event.currentTarget);
+ }}
+ onKeyDown={(event) => {
+ if (event.key !== "ArrowDown") return;
+ event.preventDefault();
+ openMenu("forward", event.currentTarget);
+ }}
+ onClick={(event) => {
+ if (forwardPress.consumeClick()) {
+ event.preventDefault();
+ return;
+ }
+ goForward();
+ }}
+ >
+ <ArrowRight aria-hidden className="size-4" />
+ </button>
+ }
+ />
+ <TooltipContent side="bottom">
+ {t(($) => $.window.go_forward)}
+ <ActionShortcutKeycaps action="goForward" />
+ <span className="text-muted-foreground">{t(($) => $.window.hold_for_history)}</span>
+ </TooltipContent>
+ </Tooltip>
<SidebarTrigger
className="size-7 text-faint-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
+ shortcut={<ActionShortcutKeycaps action="toggleSidebar" />}
style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
/>
</div>
diff --git a/packages/ui/components/common/__tests__/icon-button.test.tsx b/packages/ui/components/common/__tests__/icon-button.test.tsx
new file mode 100644
index 0000000000..8b8a97d1ac
--- /dev/null
+++ b/packages/ui/components/common/__tests__/icon-button.test.tsx
@@ -0,0 +1,225 @@
+import type { ReactNode } from "react";
+import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { IconButton } from "../icon-button";
+import { TooltipHint } from "../tooltip-hint";
+import { DeferredTooltip } from "../deferred-tooltip";
+import { TooltipProvider } from "../../ui/tooltip";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "../../ui/dropdown-menu";
+
+afterEach(cleanup);
+
+function renderWithTooltips(ui: ReactNode) {
+ return render(<TooltipProvider delay={0}>{ui}</TooltipProvider>);
+}
+
+async function hover(element: HTMLElement) {
+ await act(async () => {
+ fireEvent.pointerEnter(element, { pointerType: "mouse" });
+ fireEvent.mouseEnter(element);
+ fireEvent.pointerMove(element, { pointerType: "mouse" });
+ fireEvent.mouseMove(element);
+ });
+}
+
+describe("IconButton", () => {
+ it("names the button with its label and shows label and shortcut on hover", async () => {
+ renderWithTooltips(
+ <IconButton label="Toggle sidebar" shortcut={<kbd>⌘B</kbd>}>
+ <svg />
+ </IconButton>,
+ );
+
+ const button = screen.getByRole("button", { name: "Toggle sidebar" });
+ await hover(button);
+
+ expect(await screen.findByText("⌘B")).toBeInTheDocument();
+ expect(screen.getAllByText("Toggle sidebar").length).toBeGreaterThan(0);
+ });
+
+ it("stays natively disabled when no reason is given", () => {
+ renderWithTooltips(
+ <IconButton label="Send" disabled>
+ <svg />
+ </IconButton>,
+ );
+
+ const button = screen.getByRole("button", { name: "Send" });
+ expect(button).toBeDisabled();
+ expect(button).not.toHaveAttribute("aria-describedby");
+ });
+
+ it("keeps a disabled button hoverable and blocks activation when it has a reason", async () => {
+ const onClick = vi.fn();
+ renderWithTooltips(
+ <IconButton label="Send" disabled disabledReason="Upload in progress" onClick={onClick}>
+ <svg />
+ </IconButton>,
+ );
+
+ const button = screen.getByRole("button", { name: "Send" });
+ expect(button).not.toBeDisabled();
+ expect(button).toHaveAttribute("aria-disabled", "true");
+ expect(button).toHaveAccessibleDescription("Upload in progress");
+
+ fireEvent.click(button);
+ expect(onClick).not.toHaveBeenCalled();
+
+ await hover(button);
+ const popup = document.querySelector("[data-slot='tooltip-content']");
+ expect(popup).toHaveTextContent("Upload in progress");
+ expect(popup).not.toHaveTextContent("Send");
+ });
+
+ it("ignores the reason while enabled", () => {
+ const onClick = vi.fn();
+ renderWithTooltips(
+ <IconButton label="Send" disabledReason="Upload in progress" onClick={onClick}>
+ <svg />
+ </IconButton>,
+ );
+
+ const button = screen.getByRole("button", { name: "Send" });
+ expect(button).not.toHaveAttribute("aria-disabled");
+ expect(button).not.toHaveAccessibleDescription();
+ fireEvent.click(button);
+ expect(onClick).toHaveBeenCalledOnce();
+ });
+
+ it("works as a menu trigger's render target", async () => {
+ renderWithTooltips(
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <IconButton label="More actions">
+ <svg />
+ </IconButton>
+ }
+ />
+ <DropdownMenuContent>
+ <DropdownMenuItem>Rename</DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>,
+ );
+
+ const trigger = screen.getByRole("button", { name: "More actions" });
+ expect(trigger).toHaveAttribute("aria-haspopup", "menu");
+ await act(async () => {
+ fireEvent.click(trigger);
+ });
+ expect(await screen.findByRole("menuitem", { name: "Rename" })).toBeInTheDocument();
+ });
+});
+
+describe("TooltipHint", () => {
+ it("keeps the child's element and name and shows the label on hover", async () => {
+ const onClick = vi.fn();
+ renderWithTooltips(
+ <TooltipHint label="Copy link">
+ <button type="button" aria-label="Copy link" className="custom" onClick={onClick}>
+ <svg />
+ </button>
+ </TooltipHint>,
+ );
+
+ const button = screen.getByRole("button", { name: "Copy link" });
+ expect(button).toHaveClass("custom");
+ fireEvent.click(button);
+ expect(onClick).toHaveBeenCalledOnce();
+
+ await hover(button);
+ expect(document.querySelector("[data-slot='tooltip-content']")).toHaveTextContent("Copy link");
+ });
+
+ it("renders the child alone when there is no label", () => {
+ renderWithTooltips(
+ <TooltipHint label={undefined}>
+ <button type="button">Save</button>
+ </TooltipHint>,
+ );
+
+ const button = screen.getByRole("button", { name: "Save" });
+ expect(button).not.toHaveAttribute("data-slot", "tooltip-trigger");
+ });
+});
+
+describe("DeferredTooltip", () => {
+ it("wraps a menu trigger and stays hidden while its menu is open", async () => {
+ vi.useFakeTimers();
+ try {
+ renderWithTooltips(
+ <DropdownMenu>
+ <DeferredTooltip
+ content="Row actions"
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button type="button" aria-label="Row actions">
+ <svg />
+ </button>
+ }
+ />
+ }
+ />
+ <DropdownMenuContent>
+ <DropdownMenuItem>Rename</DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>,
+ );
+
+ const trigger = screen.getByRole("button", { name: "Row actions" });
+ expect(document.querySelector("[data-slot='tooltip-content']")).toBeNull();
+
+ fireEvent.pointerEnter(trigger, { pointerType: "mouse" });
+ await act(async () => {
+ vi.advanceTimersByTime(250);
+ });
+ expect(document.querySelector("[data-slot='tooltip-content']")).toHaveTextContent("Row actions");
+
+ await act(async () => {
+ fireEvent.click(trigger);
+ });
+ expect(screen.getByRole("menuitem", { name: "Rename" })).toBeInTheDocument();
+ expect(trigger).toHaveAttribute("aria-expanded", "true");
+
+ fireEvent.pointerLeave(trigger, { pointerType: "mouse" });
+ fireEvent.pointerEnter(trigger, { pointerType: "mouse" });
+ await act(async () => {
+ vi.advanceTimersByTime(250);
+ });
+ const popup = document.querySelector("[data-slot='tooltip-content']");
+ expect(popup === null || popup.getAttribute("data-open") === null).toBe(true);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it("still shows on an expanded disclosure toggle that has no popup", async () => {
+ vi.useFakeTimers();
+ try {
+ renderWithTooltips(
+ <DeferredTooltip
+ content="Collapse thread"
+ trigger={
+ <button type="button" aria-label="Collapse thread" aria-expanded="true">
+ <svg />
+ </button>
+ }
+ />,
+ );
+
+ fireEvent.pointerEnter(screen.getByRole("button", { name: "Collapse thread" }), { pointerType: "mouse" });
+ await act(async () => {
+ vi.advanceTimersByTime(250);
+ });
+ expect(document.querySelector("[data-slot='tooltip-content']")).toHaveTextContent("Collapse thread");
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+});
diff --git a/packages/ui/components/common/deferred-tooltip.tsx b/packages/ui/components/common/deferred-tooltip.tsx
new file mode 100644
index 0000000000..c0692ba48a
--- /dev/null
+++ b/packages/ui/components/common/deferred-tooltip.tsx
@@ -0,0 +1,105 @@
+"use client";
+
+import {
+ cloneElement,
+ useEffect,
+ useRef,
+ useState,
+ type ReactElement,
+ type ReactNode,
+ type Ref,
+} from "react";
+import { Tooltip, TooltipContent } from "@multica/ui/components/ui/tooltip";
+
+// Matches the ui TooltipProvider default delay so the deferred first-open
+// feels identical to a native tooltip.
+const TOOLTIP_OPEN_DELAY = 200;
+
+/**
+ * Tooltip whose machinery mounts only on first hover.
+ *
+ * Dense grids (board/swimlane column headers) mount hundreds of tooltip
+ * roots that are almost never hovered — a measurable slice of surface mount
+ * cost. This wrapper renders ONLY the trigger element until the pointer
+ * first enters it, then mounts a controlled Tooltip anchored to that same
+ * element.
+ *
+ * Unlike a trigger-swap approach, the trigger element is rendered by this
+ * component in the same tree position before and after warming — its DOM
+ * node is preserved, so mid-gesture events (the hover's own click) never
+ * land on a detached node. Hover open/close is driven here (timer on enter,
+ * close on leave); the popup positions against the trigger via an anchor
+ * ref instead of a Base UI trigger wrapper.
+ */
+export function DeferredTooltip({
+ trigger,
+ content,
+ side,
+}: {
+ /** The visible trigger element (e.g. an icon button). Cloned with hover
+ * handlers and an anchor ref; its own props are preserved. */
+ trigger: ReactElement<Record<string, unknown>>;
+ content: ReactNode;
+ side?: "top" | "bottom" | "left" | "right";
+}) {
+ const anchorRef = useRef<HTMLElement | null>(null);
+ const [warm, setWarm] = useState(false);
+ const [open, setOpen] = useState(false);
+ const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+ const clearTimer = () => {
+ if (timerRef.current !== null) {
+ clearTimeout(timerRef.current);
+ timerRef.current = null;
+ }
+ };
+ useEffect(() => clearTimer, []);
+
+ const triggerRef = trigger.props.ref as Ref<HTMLElement> | undefined;
+ const element = cloneElement(trigger, {
+ ref: (el: HTMLElement | null) => {
+ anchorRef.current = el;
+ if (typeof triggerRef === "function") triggerRef(el);
+ else if (triggerRef) (triggerRef as { current: HTMLElement | null }).current = el;
+ },
+ onPointerEnter: (e: React.PointerEvent) => {
+ (trigger.props.onPointerEnter as ((e: React.PointerEvent) => void) | undefined)?.(e);
+ setWarm(true);
+ clearTimer();
+ timerRef.current = setTimeout(() => {
+ // A trigger whose own menu/popover is open keeps the tooltip hidden;
+ // plain expand/collapse toggles (aria-expanded without a popup) keep it.
+ const el = anchorRef.current;
+ const popupOpen =
+ el?.hasAttribute("data-popup-open") ||
+ (el?.getAttribute("aria-expanded") === "true" &&
+ (el.getAttribute("aria-haspopup") ?? "false") !== "false");
+ if (popupOpen) return;
+ setOpen(true);
+ }, TOOLTIP_OPEN_DELAY);
+ },
+ onPointerLeave: (e: React.PointerEvent) => {
+ (trigger.props.onPointerLeave as ((e: React.PointerEvent) => void) | undefined)?.(e);
+ clearTimer();
+ setOpen(false);
+ },
+ onPointerDown: (e: React.PointerEvent) => {
+ (trigger.props.onPointerDown as ((e: React.PointerEvent) => void) | undefined)?.(e);
+ clearTimer();
+ setOpen(false);
+ },
+ });
+
+ return (
+ <>
+ {element}
+ {warm && (
+ <Tooltip open={open} onOpenChange={setOpen}>
+ <TooltipContent side={side} anchor={anchorRef}>
+ {content}
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </>
+ );
+}
diff --git a/packages/ui/components/common/file-upload-button.tsx b/packages/ui/components/common/file-upload-button.tsx
index 13fd418fa9..170f3fc33b 100644
--- a/packages/ui/components/common/file-upload-button.tsx
+++ b/packages/ui/components/common/file-upload-button.tsx
@@ -3,7 +3,7 @@
import { useRef } from "react";
import { Paperclip } from "lucide-react";
import { useTranslation } from "react-i18next";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
interface FileUploadButtonProps {
@@ -38,18 +38,17 @@ function FileUploadButton({
return (
<>
- <Button
+ <IconButton
type="button"
variant="ghost"
size={buttonSize}
onClick={() => inputRef.current?.click()}
disabled={disabled}
- aria-label={attachLabel}
- title={attachLabel}
+ label={attachLabel}
className={cn("text-muted-foreground", className)}
>
<Paperclip className={iconSize} />
- </Button>
+ </IconButton>
<input
ref={inputRef}
type="file"
diff --git a/packages/ui/components/common/icon-button.tsx b/packages/ui/components/common/icon-button.tsx
new file mode 100644
index 0000000000..260098a2b5
--- /dev/null
+++ b/packages/ui/components/common/icon-button.tsx
@@ -0,0 +1,92 @@
+"use client";
+
+import { useId, type ComponentProps, type ReactNode } from "react";
+import { Button } from "@multica/ui/components/ui/button";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@multica/ui/components/ui/tooltip";
+import { cn } from "@multica/ui/lib/utils";
+
+type IconButtonProps = Omit<ComponentProps<typeof Button>, "aria-label"> & {
+ /** Names the action: the accessible name and the tooltip text. */
+ label: string;
+ /**
+ * Keycaps shown after the label in the tooltip. Pass decorative keycaps:
+ * the accessible name stays `label`.
+ */
+ shortcut?: ReactNode;
+ /**
+ * Why the button is disabled. Only read while `disabled` is true; the
+ * tooltip shows it in place of the label. A natively disabled button takes
+ * no hover or focus, so with a reason the button switches to
+ * `aria-disabled` and Base UI blocks activation instead.
+ */
+ disabledReason?: ReactNode;
+ tooltipSide?: ComponentProps<typeof TooltipContent>["side"];
+};
+
+/**
+ * Icon-only button that always carries a visible tooltip and an accessible
+ * name. Works as the `render` target of menu and popover triggers.
+ *
+ * Mounts a full tooltip root, so prefer `DeferredTooltip` inside rows that
+ * repeat hundreds of times.
+ */
+function IconButton({
+ label,
+ shortcut,
+ disabledReason,
+ tooltipSide = "top",
+ disabled,
+ size = "icon-sm",
+ variant = "ghost",
+ className,
+ children,
+ ...props
+}: IconButtonProps) {
+ const reasonId = useId();
+ const showReason = !!disabled && disabledReason != null && disabledReason !== false;
+
+ return (
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Button
+ {...props}
+ size={size}
+ variant={variant}
+ disabled={disabled}
+ focusableWhenDisabled={showReason || props.focusableWhenDisabled}
+ aria-label={label}
+ aria-describedby={showReason ? reasonId : props["aria-describedby"]}
+ className={cn(
+ // The base only dims native `disabled`; a reasoned button is
+ // aria-disabled so it can still hover its tooltip.
+ "aria-disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:active:translate-y-0",
+ className,
+ )}
+ />
+ }
+ >
+ {children}
+ {showReason ? (
+ <span id={reasonId} className="sr-only">
+ {disabledReason}
+ </span>
+ ) : null}
+ </TooltipTrigger>
+ <TooltipContent side={tooltipSide}>
+ {showReason ? disabledReason : (
+ <>
+ {label}
+ {shortcut}
+ </>
+ )}
+ </TooltipContent>
+ </Tooltip>
+ );
+}
+
+export { IconButton, type IconButtonProps };
diff --git a/packages/ui/components/common/quick-emoji-picker.tsx b/packages/ui/components/common/quick-emoji-picker.tsx
index 42d9ff63ad..3b03f02edc 100644
--- a/packages/ui/components/common/quick-emoji-picker.tsx
+++ b/packages/ui/components/common/quick-emoji-picker.tsx
@@ -4,6 +4,7 @@ import { useState, lazy, Suspense } from "react";
import { SmilePlus } from "lucide-react";
import { cn } from "@multica/ui/lib/utils";
import { Popover, PopoverTrigger, PopoverContent } from "@multica/ui/components/ui/popover";
+import { DeferredTooltip } from "./deferred-tooltip";
const EmojiPicker = lazy(() =>
import("./emoji-picker").then((m) => ({ default: m.EmojiPicker })),
@@ -35,16 +36,20 @@ function QuickEmojiPicker({ onSelect, align = "start", className, ariaLabel = "A
return (
<Popover open={open} onOpenChange={handleOpenChange}>
- <PopoverTrigger
- render={
- <button
- type="button"
- aria-label={ariaLabel}
- title={ariaLabel}
- className={cn("inline-flex shrink-0 items-center justify-center h-6 w-6 rounded-full text-muted-foreground hover:bg-accent hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className)}
- >
- <SmilePlus className="h-3.5 w-3.5" aria-hidden />
- </button>
+ <DeferredTooltip
+ content={ariaLabel}
+ trigger={
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ aria-label={ariaLabel}
+ className={cn("inline-flex shrink-0 items-center justify-center h-6 w-6 rounded-full text-muted-foreground hover:bg-accent hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className)}
+ >
+ <SmilePlus className="h-3.5 w-3.5" aria-hidden />
+ </button>
+ }
+ />
}
/>
<PopoverContent align={align} className="w-auto p-0">
diff --git a/packages/ui/components/common/submit-button.tsx b/packages/ui/components/common/submit-button.tsx
index 63494d4450..44573ea178 100644
--- a/packages/ui/components/common/submit-button.tsx
+++ b/packages/ui/components/common/submit-button.tsx
@@ -8,6 +8,7 @@ import {
TooltipContent,
TooltipTrigger,
} from "@multica/ui/components/ui/tooltip";
+import { cn } from "@multica/ui/lib/utils";
interface SubmitButtonProps {
onClick: () => void;
@@ -17,11 +18,17 @@ interface SubmitButtonProps {
* Blocked on background work the user started (an attachment still
* uploading) rather than on a missing precondition. Disables the button and
* marks it `aria-busy`, so a screen reader reaching it with a virtual cursor
- * reads "busy" rather than an unexplained dead control. It is NOT tab
- * reachable while disabled, so callers should also carry the reason in
- * `ariaLabel` / `tooltip` and in the visible label where there is one.
+ * reads "busy" rather than an unexplained dead control. Pass the reason as
+ * `disabledReason` so it stays hoverable and focusable.
*/
busy?: boolean;
+ /**
+ * Why the button is disabled; shown as its tooltip instead of `tooltip`.
+ * A natively disabled button takes no hover or focus, so with a reason the
+ * button is `aria-disabled` and Base UI blocks activation instead. Ignored
+ * while `loading`.
+ */
+ disabledReason?: ReactNode;
running?: boolean;
onStop?: () => void;
/**
@@ -51,6 +58,7 @@ function SubmitButton({
busy,
running,
onStop,
+ disabledReason,
tooltip,
ariaLabel,
stopTooltip,
@@ -77,12 +85,18 @@ function SubmitButton({
) : stopButton;
}
+ const isDisabled = !!(disabled || loading || busy);
+ const showReason = isDisabled && !loading && disabledReason != null && disabledReason !== false;
const submitButton = (
<Button
size="icon-sm"
- className="rounded-full"
- disabled={disabled || loading || busy}
- aria-disabled={busy || undefined}
+ className={cn(
+ "rounded-full",
+ showReason && "aria-disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:active:translate-y-0",
+ )}
+ disabled={isDisabled}
+ focusableWhenDisabled={showReason}
+ {...(busy && !showReason ? { "aria-disabled": true } : {})}
aria-busy={loading || busy || undefined}
onPointerDown={keepFocusInComposer}
onMouseDown={keepFocusInComposer}
@@ -101,12 +115,13 @@ function SubmitButton({
)}
</Button>
);
- const submitControl = !tooltip
+ const tooltipContent = showReason ? disabledReason : tooltip;
+ const submitControl = !tooltipContent
? submitButton
: (
<Tooltip>
<TooltipTrigger render={submitButton} />
- <TooltipContent side="top">{tooltip}</TooltipContent>
+ <TooltipContent side="top">{tooltipContent}</TooltipContent>
</Tooltip>
);
return submitControl;
diff --git a/packages/ui/components/common/theme-provider.tsx b/packages/ui/components/common/theme-provider.tsx
index a8cd428a9d..483ae6b97a 100644
--- a/packages/ui/components/common/theme-provider.tsx
+++ b/packages/ui/components/common/theme-provider.tsx
@@ -15,7 +15,7 @@ export function ThemeProvider({
disableTransitionOnChange
{...props}
>
- <TooltipProvider delay={500}>
+ <TooltipProvider delay={200}>
{children}
</TooltipProvider>
</NextThemesProvider>
diff --git a/packages/ui/components/common/tooltip-hint.tsx b/packages/ui/components/common/tooltip-hint.tsx
new file mode 100644
index 0000000000..b0347cd839
--- /dev/null
+++ b/packages/ui/components/common/tooltip-hint.tsx
@@ -0,0 +1,41 @@
+"use client";
+
+import type { ComponentProps, ReactElement, ReactNode } from "react";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@multica/ui/components/ui/tooltip";
+
+/**
+ * Tooltip for a control that keeps its own element and styling (a raw
+ * `<button>`, a link, a menu trigger, a text button that needs a longer
+ * explanation). The child must carry its own accessible name; prefer
+ * `IconButton` for a plain icon `Button`. A `null`/`undefined` label renders
+ * the child alone, for hints that only apply in some states.
+ */
+function TooltipHint({
+ label,
+ shortcut,
+ side = "top",
+ children,
+}: {
+ label: ReactNode;
+ /** Decorative keycaps shown after the label. */
+ shortcut?: ReactNode;
+ side?: ComponentProps<typeof TooltipContent>["side"];
+ children: ReactElement;
+}) {
+ if (label == null || label === false || label === "") return children;
+ return (
+ <Tooltip>
+ <TooltipTrigger render={children} />
+ <TooltipContent side={side}>
+ {label}
+ {shortcut}
+ </TooltipContent>
+ </Tooltip>
+ );
+}
+
+export { TooltipHint };
diff --git a/packages/ui/components/ui/sidebar.tsx b/packages/ui/components/ui/sidebar.tsx
index 8db120379f..34821a6282 100644
--- a/packages/ui/components/ui/sidebar.tsx
+++ b/packages/ui/components/ui/sidebar.tsx
@@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next"
import { useIsCompact } from "@multica/ui/hooks/use-mobile"
import { cn } from "@multica/ui/lib/utils"
-import { Button } from "@multica/ui/components/ui/button"
+import { IconButton } from "@multica/ui/components/common/icon-button"
import { Input } from "@multica/ui/components/ui/input"
import { Separator } from "@multica/ui/components/ui/separator"
import {
@@ -395,17 +395,19 @@ function Sidebar({
function SidebarTrigger({
className,
onClick,
+ shortcut,
...props
-}: React.ComponentProps<typeof Button>) {
+}: Omit<React.ComponentProps<typeof IconButton>, "label">) {
const { toggleSidebar } = useSidebar()
const { t } = useTranslation("ui")
return (
- <Button
+ <IconButton
data-sidebar="trigger"
data-slot="sidebar-trigger"
- variant="ghost"
- size="icon-sm"
+ label={t(($) => $.toggle_sidebar)}
+ shortcut={shortcut}
+ tooltipSide="bottom"
className={cn(className)}
onClick={(event) => {
onClick?.(event)
@@ -414,8 +416,7 @@ function SidebarTrigger({
{...props}
>
<PanelLeftIcon />
- <span className="sr-only">{t(($) => $.toggle_sidebar)}</span>
- </Button>
+ </IconButton>
)
}
diff --git a/packages/views/agents/components/agent-batch-toolbar.tsx b/packages/views/agents/components/agent-batch-toolbar.tsx
index f0aedefa6b..76e3cea361 100644
--- a/packages/views/agents/components/agent-batch-toolbar.tsx
+++ b/packages/views/agents/components/agent-batch-toolbar.tsx
@@ -9,6 +9,7 @@ import { api } from "@multica/core/api";
import { useWorkspaceId } from "@multica/core/hooks";
import { workspaceKeys } from "@multica/core/workspace/queries";
import { Button } from "@multica/ui/components/ui/button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
UI_EASE_OUT,
UI_MOTION_DURATION,
@@ -175,14 +176,16 @@ export function AgentBatchToolbar({
<span className="text-body font-medium">
{t(($) => $.actions.selected, { count: rows.length })}
</span>
- <button
- type="button"
- aria-label={t(($) => $.actions.clear_selection)}
- onClick={onClear}
- className="rounded-xs p-0.5 transition-colors hover:bg-accent"
- >
- <X className="size-3.5 text-muted-foreground" />
- </button>
+ <TooltipHint label={t(($) => $.actions.clear_selection)}>
+ <button
+ type="button"
+ aria-label={t(($) => $.actions.clear_selection)}
+ onClick={onClear}
+ className="rounded-xs p-0.5 transition-colors hover:bg-accent"
+ >
+ <X className="size-3.5 text-muted-foreground" />
+ </button>
+ </TooltipHint>
</div>
{anyArchived && (
diff --git a/packages/views/agents/components/agent-detail-page.tsx b/packages/views/agents/components/agent-detail-page.tsx
index 2aacac4023..523f3482cc 100644
--- a/packages/views/agents/components/agent-detail-page.tsx
+++ b/packages/views/agents/components/agent-detail-page.tsx
@@ -40,6 +40,7 @@ import {
import { runtimeDisplayLabel, runtimeListOptions } from "@multica/core/runtimes";
import { useAgentPermissions } from "@multica/core/permissions";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { CapabilityBanner } from "@multica/ui/components/common/capability-banner";
import {
Dialog,
@@ -588,8 +589,14 @@ function DetailHeader({
{!isArchived && canArchive && hasMoreActions ? (
<DropdownMenu>
<DropdownMenuTrigger
- render={<Button variant="ghost" size="icon-sm" />}
- aria-label={t(($) => $.detail.more_actions_aria)}
+ render={
+ <IconButton
+ variant="ghost"
+ size="icon-sm"
+ label={t(($) => $.detail.more_actions_aria)}
+ tooltipSide="bottom"
+ />
+ }
>
<MoreHorizontal
className="h-4 w-4 text-muted-foreground"
diff --git a/packages/views/agents/components/agent-list-toolbar.tsx b/packages/views/agents/components/agent-list-toolbar.tsx
index 39916f88fb..c649dd07b8 100644
--- a/packages/views/agents/components/agent-list-toolbar.tsx
+++ b/packages/views/agents/components/agent-list-toolbar.tsx
@@ -25,6 +25,7 @@ import {
type AgentSortField,
} from "@multica/core/agents/stores";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import {
DropdownMenu,
@@ -571,7 +572,7 @@ export function AgentListToolbar({
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
- <Button
+ <IconButton
variant="outline"
size="icon-sm"
onClick={() =>
@@ -579,7 +580,7 @@ export function AgentListToolbar({
sortDirection === "asc" ? "desc" : "asc",
)
}
- title={
+ label={
sortDirection === "asc"
? t(($) => $.toolbar.direction_asc)
: t(($) => $.toolbar.direction_desc)
@@ -590,7 +591,7 @@ export function AgentListToolbar({
) : (
<ArrowDown className="size-3.5" />
)}
- </Button>
+ </IconButton>
</div>
</div>
diff --git a/packages/views/agents/components/agent-row-actions.tsx b/packages/views/agents/components/agent-row-actions.tsx
index f4af518661..3bfe1a91d6 100644
--- a/packages/views/agents/components/agent-row-actions.tsx
+++ b/packages/views/agents/components/agent-row-actions.tsx
@@ -37,6 +37,7 @@ import {
} from "@multica/ui/components/ui/dropdown-menu";
import { useT } from "../../i18n";
import { AppLink, useIntentNavigate } from "../../navigation";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
interface AgentRowActionsProps {
agent: Agent;
@@ -137,15 +138,20 @@ export function AgentRowActions({
return (
<>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={t(($) => $.row.actions_aria)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-100 @2xl:opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
- >
- <MoreHorizontal className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.row.actions_aria)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.row.actions_aria)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-100 @2xl:opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ >
+ <MoreHorizontal className="size-4" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-auto">
diff --git a/packages/views/agents/components/conversation-starters-editor.tsx b/packages/views/agents/components/conversation-starters-editor.tsx
index a5191a84ae..ce240d413f 100644
--- a/packages/views/agents/components/conversation-starters-editor.tsx
+++ b/packages/views/agents/components/conversation-starters-editor.tsx
@@ -9,6 +9,7 @@ import {
} from "@multica/core/agents";
import type { AgentConversationStarter } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import {
@@ -73,12 +74,12 @@ export function ConversationStartersEditor({
placeholder={t(($) => $.conversation_starters.label_placeholder)}
onChange={(event) => update(index, "label", event.target.value)}
/>
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
disabled={disabled}
- aria-label={t(($) => $.conversation_starters.remove, {
+ label={t(($) => $.conversation_starters.remove, {
number: index + 1,
})}
onClick={() =>
@@ -86,7 +87,7 @@ export function ConversationStartersEditor({
}
>
<Trash2 className="size-4" aria-hidden="true" />
- </Button>
+ </IconButton>
</div>
<Textarea
value={item.prompt}
diff --git a/packages/views/agents/components/create-agent-dialog.test.tsx b/packages/views/agents/components/create-agent-dialog.test.tsx
index 67ad553bfd..ed04fd554a 100644
--- a/packages/views/agents/components/create-agent-dialog.test.tsx
+++ b/packages/views/agents/components/create-agent-dialog.test.tsx
@@ -184,8 +184,7 @@ describe("CreateAgentDialog runtime visibility gate", () => {
.getByText("Others Private")
.closest("button") as HTMLButtonElement;
expect(disabledRow).not.toBeNull();
- expect(disabledRow.disabled).toBe(true);
- expect(disabledRow.title).toMatch(/Private runtime/i);
+ expect(disabledRow).toHaveAttribute("aria-disabled", "true");
});
it("lets a plain member pick another member's public runtime", () => {
diff --git a/packages/views/agents/components/create-agent-dialog.tsx b/packages/views/agents/components/create-agent-dialog.tsx
index 362644c4ba..b6cebdb2b6 100644
--- a/packages/views/agents/components/create-agent-dialog.tsx
+++ b/packages/views/agents/components/create-agent-dialog.tsx
@@ -32,6 +32,7 @@ import {
DialogDescription,
} from "@multica/ui/components/ui/dialog";
import { Button } from "@multica/ui/components/ui/button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Checkbox } from "@multica/ui/components/ui/checkbox";
import { Input } from "@multica/ui/components/ui/input";
import { Label } from "@multica/ui/components/ui/label";
@@ -465,19 +466,25 @@ export function CreateAgentDialog({
<Button variant="ghost" onClick={onClose}>
{t(($) => $.create_dialog.cancel)}
</Button>
- <Button
- onClick={handleSubmit}
- disabled={
- creating || !name.trim() || !selectedRuntime || selectedRuntimeLocked
- }
- title={
+ <TooltipHint
+ label={
selectedRuntimeLocked
? t(($) => $.create_dialog.runtime_private_locked_tooltip)
: undefined
}
>
- {creating ? t(($) => $.create_dialog.creating) : t(($) => $.create_dialog.create)}
- </Button>
+ <Button
+ onClick={handleSubmit}
+ disabled={
+ creating || !name.trim() || !selectedRuntime || selectedRuntimeLocked
+ }
+ // Keeps the button hoverable so its tooltip can say why it is blocked.
+ focusableWhenDisabled={selectedRuntimeLocked}
+ className="aria-disabled:cursor-not-allowed aria-disabled:opacity-50"
+ >
+ {creating ? t(($) => $.create_dialog.creating) : t(($) => $.create_dialog.create)}
+ </Button>
+ </TooltipHint>
</div>
</DialogContent>
</Dialog>
diff --git a/packages/views/agents/components/inspector/model-picker.tsx b/packages/views/agents/components/inspector/model-picker.tsx
index 85e9622489..ae423b64c5 100644
--- a/packages/views/agents/components/inspector/model-picker.tsx
+++ b/packages/views/agents/components/inspector/model-picker.tsx
@@ -16,6 +16,7 @@ import { CHIP_CLASS } from "./chip";
import { useT } from "../../../i18n";
import { UnavailableModelsNote } from "../unavailable-models-note";
import { ModelSearchHeader } from "../model-search-header";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
/**
* Inline model picker for the agent inspector. Lighter cousin of
@@ -279,14 +280,15 @@ export function ModelPicker({
)}
{value && (
- <button
- type="button"
- onClick={() => void select("")}
- className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50"
- title={t(($) => $.pickers.model_clear_title)}
- >
- {t(($) => $.pickers.model_clear)}
- </button>
+ <TooltipHint label={t(($) => $.pickers.model_clear_title)}>
+ <button
+ type="button"
+ onClick={() => void select("")}
+ className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50"
+ >
+ {t(($) => $.pickers.model_clear)}
+ </button>
+ </TooltipHint>
)}
</PropertyPicker>
);
diff --git a/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx b/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx
index ac08670c84..e99c6b07dd 100644
--- a/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx
+++ b/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx
@@ -189,7 +189,7 @@ describe("ServiceTierSettingField", () => {
await screen.findByText("Speed");
expect(await screen.findByText("priority")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button"));
- fireEvent.click(await screen.findByTitle(/Clear the speed override/i));
+ fireEvent.click(await screen.findByRole("button", { name: "Runtime default" }));
expect(onChange).toHaveBeenCalledWith("");
});
});
diff --git a/packages/views/agents/components/inspector/service-tier-setting-field.tsx b/packages/views/agents/components/inspector/service-tier-setting-field.tsx
index 56e0844788..7d5d8ada5d 100644
--- a/packages/views/agents/components/inspector/service-tier-setting-field.tsx
+++ b/packages/views/agents/components/inspector/service-tier-setting-field.tsx
@@ -12,6 +12,7 @@ import {
import { SettingsRow } from "../../../settings/components/settings-layout";
import { useT } from "../../../i18n";
import { findModelCapabilityEntry } from "./model-capability";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
/**
* Full-width service-tier field for Codex agents. Capability comes from the
@@ -162,14 +163,15 @@ function ServiceTierPicker({
</PickerItem>
))}
{value ? (
- <button
- type="button"
- onClick={() => void select("")}
- className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50"
- title={t(($) => $.pickers.service_tier_clear_title)}
- >
- {t(($) => $.pickers.service_tier_clear)}
- </button>
+ <TooltipHint label={t(($) => $.pickers.service_tier_clear_title)}>
+ <button
+ type="button"
+ onClick={() => void select("")}
+ className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50"
+ >
+ {t(($) => $.pickers.service_tier_clear)}
+ </button>
+ </TooltipHint>
) : null}
</PropertyPicker>
);
diff --git a/packages/views/agents/components/inspector/skill-attach.tsx b/packages/views/agents/components/inspector/skill-attach.tsx
index e37ea4aaa6..dc0b4e8de4 100644
--- a/packages/views/agents/components/inspector/skill-attach.tsx
+++ b/packages/views/agents/components/inspector/skill-attach.tsx
@@ -8,6 +8,7 @@ import { useWorkspaceId } from "@multica/core/hooks";
import { skillListOptions } from "@multica/core/workspace/queries";
import { SkillAddDialog } from "../skill-add-dialog";
import { useT } from "../../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
/**
* Inline "+ Attach" trigger for the inspector's Skills row. The trigger is
@@ -40,16 +41,17 @@ export function SkillAttach({
return (
<>
- <button
- type="button"
- onClick={() => setOpen(true)}
- aria-label={t(($) => $.skill_attach.trigger_aria)}
- title={t(($) => $.skill_attach.trigger_aria)}
- className="inline-flex cursor-pointer items-center gap-0.5 rounded-md border border-dashed border-muted-foreground/30 px-1.5 py-0.5 text-micro font-medium text-muted-foreground transition-colors hover:border-muted-foreground/60 hover:bg-accent/50 hover:text-muted-foreground"
- >
- <Plus className="h-2.5 w-2.5" />
- {t(($) => $.skill_attach.trigger_label)}
- </button>
+ <TooltipHint label={t(($) => $.skill_attach.trigger_aria)}>
+ <button
+ type="button"
+ onClick={() => setOpen(true)}
+ aria-label={t(($) => $.skill_attach.trigger_aria)}
+ className="inline-flex cursor-pointer items-center gap-0.5 rounded-md border border-dashed border-muted-foreground/30 px-1.5 py-0.5 text-micro font-medium text-muted-foreground transition-colors hover:border-muted-foreground/60 hover:bg-accent/50 hover:text-muted-foreground"
+ >
+ <Plus className="h-2.5 w-2.5" />
+ {t(($) => $.skill_attach.trigger_label)}
+ </button>
+ </TooltipHint>
<SkillAddDialog agent={agent} open={open} onOpenChange={setOpen} />
</>
);
diff --git a/packages/views/agents/components/inspector/thinking-picker.test.tsx b/packages/views/agents/components/inspector/thinking-picker.test.tsx
index 275b874182..73c4d5639f 100644
--- a/packages/views/agents/components/inspector/thinking-picker.test.tsx
+++ b/packages/views/agents/components/inspector/thinking-picker.test.tsx
@@ -97,9 +97,7 @@ describe("ThinkingPicker", () => {
it("clears to empty string via the footer button when a value is set", () => {
const { onChange } = renderPicker({ value: "high" });
fireEvent.click(screen.getByRole("button"));
- // Footer copy resolves through i18n — match a substring so we don't
- // pin to the exact translated wording.
- const clearButton = screen.getByTitle(/Clear the override/i);
+ const clearButton = screen.getByRole("button", { name: "Follow CLI config" });
fireEvent.click(clearButton);
expect(onChange).toHaveBeenCalledWith("");
});
@@ -107,6 +105,6 @@ describe("ThinkingPicker", () => {
it("does not render the clear button when value is already empty", () => {
renderPicker({ value: "" });
fireEvent.click(screen.getByRole("button"));
- expect(screen.queryByTitle(/Clear and fall back/i)).toBeNull();
+ expect(screen.queryByRole("button", { name: "Follow CLI config" })).toBeNull();
});
});
diff --git a/packages/views/agents/components/inspector/thinking-picker.tsx b/packages/views/agents/components/inspector/thinking-picker.tsx
index b341aa0626..67992ff654 100644
--- a/packages/views/agents/components/inspector/thinking-picker.tsx
+++ b/packages/views/agents/components/inspector/thinking-picker.tsx
@@ -10,6 +10,7 @@ import {
} from "../../../issues/components/pickers";
import { CHIP_CLASS } from "./chip";
import { useT } from "../../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
/**
* Per-agent reasoning/effort picker (MUL-2339). Renders only when the
@@ -171,14 +172,15 @@ export function ThinkingPicker({
))}
{value && (
- <button
- type="button"
- onClick={() => void select("")}
- className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50"
- title={t(($) => $.pickers.thinking_clear_title)}
- >
- {t(($) => $.pickers.thinking_clear)}
- </button>
+ <TooltipHint label={t(($) => $.pickers.thinking_clear_title)}>
+ <button
+ type="button"
+ onClick={() => void select("")}
+ className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50"
+ >
+ {t(($) => $.pickers.thinking_clear)}
+ </button>
+ </TooltipHint>
)}
</PropertyPicker>
);
diff --git a/packages/views/agents/components/inspector/thinking-prop-row.test.tsx b/packages/views/agents/components/inspector/thinking-prop-row.test.tsx
index 7f249386f5..f8f78f3da8 100644
--- a/packages/views/agents/components/inspector/thinking-prop-row.test.tsx
+++ b/packages/views/agents/components/inspector/thinking-prop-row.test.tsx
@@ -230,7 +230,7 @@ describe("ThinkingPropRow", () => {
// matching the i18n `thinking_clear_title` copy.
await screen.findByText("xhigh");
fireEvent.click(screen.getByRole("button"));
- const clearButton = await screen.findByTitle(/Clear the override/i);
+ const clearButton = await screen.findByRole("button", { name: "Follow CLI config" });
fireEvent.click(clearButton);
expect(onChange).toHaveBeenCalledWith("");
@@ -302,7 +302,7 @@ describe("ThinkingPropRow", () => {
await screen.findByText("Thinking");
expect(await screen.findByText("ultra")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button"));
- const clearButton = await screen.findByTitle(/Clear the override/i);
+ const clearButton = await screen.findByRole("button", { name: "Follow CLI config" });
fireEvent.click(clearButton);
expect(onChange).toHaveBeenCalledWith("");
});
@@ -361,7 +361,7 @@ describe("ThinkingPropRow", () => {
await screen.findByText("Thinking");
expect(await screen.findByText("max")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button"));
- const clearButton = await screen.findByTitle(/Clear the override/i);
+ const clearButton = await screen.findByRole("button", { name: "Follow CLI config" });
fireEvent.click(clearButton);
expect(onChange).toHaveBeenCalledWith("");
});
diff --git a/packages/views/agents/components/model-search-header.tsx b/packages/views/agents/components/model-search-header.tsx
index 72145bc590..5b1ec141ba 100644
--- a/packages/views/agents/components/model-search-header.tsx
+++ b/packages/views/agents/components/model-search-header.tsx
@@ -1,7 +1,7 @@
"use client";
import { RefreshCw } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { useT } from "../../i18n";
@@ -37,11 +37,11 @@ export function ModelSearchHeader({
onChange={(event) => onChange(event.target.value)}
className={compact ? "h-7 min-w-0 flex-1 text-caption" : "h-8 min-w-0 flex-1"}
/>
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={refreshLabel}
+ label={refreshLabel}
onClick={onRefresh}
disabled={refreshDisabled || refreshing}
>
@@ -51,7 +51,7 @@ export function ModelSearchHeader({
}
aria-hidden="true"
/>
- </Button>
+ </IconButton>
</div>
);
}
diff --git a/packages/views/agents/components/runtime-picker.tsx b/packages/views/agents/components/runtime-picker.tsx
index a0bf336e63..5eb1047fe4 100644
--- a/packages/views/agents/components/runtime-picker.tsx
+++ b/packages/views/agents/components/runtime-picker.tsx
@@ -21,6 +21,7 @@ import {
filterRuntimeMachines,
runtimeRowLabel,
} from "../../runtimes/components/runtime-machines";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
export type RuntimeFilter = "mine" | "all";
@@ -251,72 +252,72 @@ export function RuntimePicker({
? t(($) => $.create_dialog.runtime_private_locked_tooltip)
: undefined;
return (
- <button
- key={device.id}
- type="button"
- disabled={disabled}
- title={disabledTitle}
- onClick={() => {
- if (disabled) return;
- onSelect(device.id);
- setOpen(false);
- }}
- className={`flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-body transition-colors ${
- disabled
- ? "cursor-not-allowed opacity-50"
- : device.id === selectedRuntimeId
- ? "bg-accent"
- : "hover:bg-accent/50"
- }`}
- >
- <ProviderLogo
- provider={device.provider}
- className="h-4 w-4 shrink-0"
- />
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-2">
- <span className="truncate font-medium">
- {runtimeRowLabel(device, machine.title)}
- </span>
- {device.runtime_mode === "cloud" && (
- <span className="shrink-0 rounded-xs bg-info/10 px-1.5 py-0.5 text-caption font-medium text-info">
- {t(($) => $.create_dialog.runtime_cloud_badge)}
- </span>
- )}
- {disabled && (
- <span className="shrink-0 inline-flex items-center gap-1 rounded-xs bg-muted px-1.5 py-0.5 text-micro font-medium text-muted-foreground">
- <Lock className="h-3 w-3" />
- {t(($) => $.create_dialog.runtime_private_badge)}
+ <TooltipHint key={device.id} label={disabledTitle}>
+ <button
+ type="button"
+ aria-disabled={disabled || undefined}
+ onClick={() => {
+ if (disabled) return;
+ onSelect(device.id);
+ setOpen(false);
+ }}
+ className={`flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-body transition-colors ${
+ disabled
+ ? "cursor-not-allowed opacity-50"
+ : device.id === selectedRuntimeId
+ ? "bg-accent"
+ : "hover:bg-accent/50"
+ }`}
+ >
+ <ProviderLogo
+ provider={device.provider}
+ className="h-4 w-4 shrink-0"
+ />
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-2">
+ <span className="truncate font-medium">
+ {runtimeRowLabel(device, machine.title)}
</span>
- )}
- </div>
- <div className="mt-0.5 flex items-center gap-1 text-caption text-muted-foreground">
- {ownerMember ? (
- <>
- <ActorAvatar
- actorType="member"
- actorId={ownerMember.user_id}
- size="xs"
- />
+ {device.runtime_mode === "cloud" && (
+ <span className="shrink-0 rounded-xs bg-info/10 px-1.5 py-0.5 text-caption font-medium text-info">
+ {t(($) => $.create_dialog.runtime_cloud_badge)}
+ </span>
+ )}
+ {disabled && (
+ <span className="shrink-0 inline-flex items-center gap-1 rounded-xs bg-muted px-1.5 py-0.5 text-micro font-medium text-muted-foreground">
+ <Lock className="h-3 w-3" />
+ {t(($) => $.create_dialog.runtime_private_badge)}
+ </span>
+ )}
+ </div>
+ <div className="mt-0.5 flex items-center gap-1 text-caption text-muted-foreground">
+ {ownerMember ? (
+ <>
+ <ActorAvatar
+ actorType="member"
+ actorId={ownerMember.user_id}
+ size="xs"
+ />
+ <span className="truncate">
+ {ownerMember.name}
+ </span>
+ </>
+ ) : (
<span className="truncate">
- {ownerMember.name}
+ {device.device_info}
</span>
- </>
- ) : (
- <span className="truncate">
- {device.device_info}
- </span>
- )}
+ )}
+ </div>
</div>
- </div>
- <span
- className={`h-2 w-2 shrink-0 rounded-full ${
- device.status === "online"
- ? "bg-success"
- : "bg-muted-foreground/40"
- }`}
- />
- </button>
+ <span
+ className={`h-2 w-2 shrink-0 rounded-full ${
+ device.status === "online"
+ ? "bg-success"
+ : "bg-muted-foreground/40"
+ }`}
+ />
+ </button>
+ </TooltipHint>
);
})}
</div>
diff --git a/packages/views/agents/components/tabs/custom-args-tab.tsx b/packages/views/agents/components/tabs/custom-args-tab.tsx
index e43a52c855..217ffcfab1 100644
--- a/packages/views/agents/components/tabs/custom-args-tab.tsx
+++ b/packages/views/agents/components/tabs/custom-args-tab.tsx
@@ -12,6 +12,7 @@ import {
import type { Agent, RuntimeDevice } from "@multica/core/types";
import { createSafeId } from "@multica/core/utils";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { toast } from "sonner";
import { useT } from "../../../i18n";
@@ -222,31 +223,31 @@ export function CustomArgsTab({
{entry.value}
</code>
<div className="flex shrink-0 items-center gap-0.5">
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
onClick={() => startEditing(entry)}
disabled={editor !== null}
- aria-label={t(($) => $.tab_body.custom_args.edit_aria, {
+ label={t(($) => $.tab_body.custom_args.edit_aria, {
index: index + 1,
})}
>
<Pencil className="size-3.5" aria-hidden="true" />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
onClick={() => removeEntry(entry.id)}
disabled={editor !== null}
className="text-muted-foreground hover:text-destructive"
- aria-label={t(($) => $.tab_body.custom_args.remove_aria, {
+ label={t(($) => $.tab_body.custom_args.remove_aria, {
index: index + 1,
})}
>
<Trash2 className="size-3.5" aria-hidden="true" />
- </Button>
+ </IconButton>
</div>
</div>
)}
diff --git a/packages/views/agents/components/tabs/env-tab.tsx b/packages/views/agents/components/tabs/env-tab.tsx
index b52abd5f19..33b5c3b7ea 100644
--- a/packages/views/agents/components/tabs/env-tab.tsx
+++ b/packages/views/agents/components/tabs/env-tab.tsx
@@ -16,6 +16,8 @@ import {
import { api } from "@multica/core/api";
import type { Agent } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { toast } from "sonner";
@@ -454,32 +456,40 @@ export function EnvTab({
placeholder={t(($) => $.tab_body.env.value_placeholder)}
className="pr-8 font-mono text-caption"
/>
- <button
- type="button"
- onClick={() => toggleEnvVisibility(index)}
- className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
- aria-label={
+ <TooltipHint
+ label={
entry.visible
? t(($) => $.tab_body.env.hide_value_aria)
: t(($) => $.tab_body.env.show_value_aria)
}
>
- {entry.visible ? (
- <EyeOff className="h-3.5 w-3.5" />
- ) : (
- <Eye className="h-3.5 w-3.5" />
- )}
- </button>
+ <button
+ type="button"
+ onClick={() => toggleEnvVisibility(index)}
+ className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
+ aria-label={
+ entry.visible
+ ? t(($) => $.tab_body.env.hide_value_aria)
+ : t(($) => $.tab_body.env.show_value_aria)
+ }
+ >
+ {entry.visible ? (
+ <EyeOff className="h-3.5 w-3.5" />
+ ) : (
+ <Eye className="h-3.5 w-3.5" />
+ )}
+ </button>
+ </TooltipHint>
</div>
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
onClick={() => removeEnvEntry(index)}
className="text-muted-foreground hover:text-destructive"
- aria-label={t(($) => $.tab_body.env.remove_aria)}
+ label={t(($) => $.tab_body.env.remove_aria)}
>
<Trash2 className="h-3.5 w-3.5" />
- </Button>
+ </IconButton>
</div>
))}
</div>
diff --git a/packages/views/agents/components/tabs/mcp-server-dialog.tsx b/packages/views/agents/components/tabs/mcp-server-dialog.tsx
index 679af09bdc..42057b788a 100644
--- a/packages/views/agents/components/tabs/mcp-server-dialog.tsx
+++ b/packages/views/agents/components/tabs/mcp-server-dialog.tsx
@@ -9,6 +9,7 @@ import {
} from "react";
import { Globe2, Loader2, Plus, SquareTerminal, Trash2 } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
import {
Dialog,
@@ -737,18 +738,18 @@ function StringListEditor({
))
}
/>
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon"
className="shrink-0 text-muted-foreground hover:text-destructive"
- aria-label={`${removeLabel} ${index + 1}`}
+ label={`${removeLabel} ${index + 1}`}
onClick={() =>
onChange(values.filter((_, itemIndex) => itemIndex !== index))
}
>
<Trash2 aria-hidden="true" />
- </Button>
+ </IconButton>
</div>
))}
</div>
@@ -831,18 +832,18 @@ function KeyValueEditor({
}
/>
</div>
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon"
className="shrink-0 text-muted-foreground hover:text-destructive"
- aria-label={`${removeLabel} ${index + 1}`}
+ label={`${removeLabel} ${index + 1}`}
onClick={() =>
onChange(rows.filter((_, itemIndex) => itemIndex !== index))
}
>
<Trash2 aria-hidden="true" />
- </Button>
+ </IconButton>
</div>
))}
</div>
diff --git a/packages/views/agents/components/tabs/skills-tab.tsx b/packages/views/agents/components/tabs/skills-tab.tsx
index 9395b847a4..ef8da528e5 100644
--- a/packages/views/agents/components/tabs/skills-tab.tsx
+++ b/packages/views/agents/components/tabs/skills-tab.tsx
@@ -31,6 +31,7 @@ import {
} from "@multica/core/workspace/queries";
import { Badge } from "@multica/ui/components/ui/badge";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
Dialog,
DialogContent,
@@ -211,18 +212,18 @@ export function SkillsTab({
})}
/>
)}
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
onClick={() => handleRemove(skill.id)}
disabled={busyId !== null}
- aria-label={t(($) => $.tab_body.skills.remove_aria, {
+ label={t(($) => $.tab_body.skills.remove_aria, {
name: skill.name,
})}
className="text-muted-foreground hover:text-destructive"
>
<Trash2 className="h-3.5 w-3.5" />
- </Button>
+ </IconButton>
</>
)}
</li>
diff --git a/packages/views/agents/create/builder-conversation.tsx b/packages/views/agents/create/builder-conversation.tsx
index 8a042b10d2..3a57b5d31e 100644
--- a/packages/views/agents/create/builder-conversation.tsx
+++ b/packages/views/agents/create/builder-conversation.tsx
@@ -16,6 +16,7 @@ import type {
RuntimeDevice,
} from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
import { ChatInput } from "../../chat/components/chat-input";
import { CHAT_COLUMN, CHAT_GUTTER } from "../../chat/components/chat-column";
@@ -243,16 +244,16 @@ export function BuilderConversation({
>
<span className="min-w-0 flex-1">{error}</span>
{onDismissError && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
className="shrink-0"
- aria-label={tModals(($) => $.common.close)}
+ label={tModals(($) => $.common.close)}
onClick={onDismissError}
>
<X className="size-4" />
- </Button>
+ </IconButton>
)}
</div>
</div>
diff --git a/packages/views/agents/create/create-shell.tsx b/packages/views/agents/create/create-shell.tsx
index e01d8745b4..b8d5106407 100644
--- a/packages/views/agents/create/create-shell.tsx
+++ b/packages/views/agents/create/create-shell.tsx
@@ -2,7 +2,7 @@
import type { ReactNode } from "react";
import { ArrowLeft } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { useT } from "../../i18n";
/**
@@ -31,16 +31,17 @@ export function AgentCreateShell({
return (
<div className="flex min-h-0 flex-1 flex-col bg-background">
<header className="flex h-14 shrink-0 items-center gap-3 border-b px-5">
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon"
onClick={onBack}
disabled={backDisabled}
- aria-label={t(($) => $.creation_studio.back)}
+ label={t(($) => $.creation_studio.back)}
+ tooltipSide="bottom"
>
<ArrowLeft className="size-4" aria-hidden="true" />
- </Button>
+ </IconButton>
<div className="min-w-0">
<h1 className="truncate text-body font-semibold">{title}</h1>
<p className="truncate text-caption text-muted-foreground">{step}</p>
diff --git a/packages/views/autopilots/components/autopilot-access-manager.tsx b/packages/views/autopilots/components/autopilot-access-manager.tsx
index 1a7f375844..bd1b571199 100644
--- a/packages/views/autopilots/components/autopilot-access-manager.tsx
+++ b/packages/views/autopilots/components/autopilot-access-manager.tsx
@@ -12,6 +12,7 @@ import {
} from "@multica/core/autopilots/mutations";
import type { AutopilotCollaborator } from "@multica/core/types";
import { toast } from "sonner";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { ActorAvatar } from "../../common/actor-avatar";
import {
PropertyPicker,
@@ -140,15 +141,17 @@ export function AutopilotAccessManager({
{getActorName("member", c.user_id)}
</span>
</span>
- <button
- type="button"
- onClick={() => void handleRevoke(c.user_id)}
- disabled={revoke.isPending}
- className="cursor-pointer text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"
- aria-label={t(($) => $.access.remove_tooltip)}
- >
- <X className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.access.remove_tooltip)}>
+ <button
+ type="button"
+ onClick={() => void handleRevoke(c.user_id)}
+ disabled={revoke.isPending}
+ className="cursor-pointer text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"
+ aria-label={t(($) => $.access.remove_tooltip)}
+ >
+ <X className="size-3.5" />
+ </button>
+ </TooltipHint>
</li>
))}
</ul>
diff --git a/packages/views/autopilots/components/autopilot-detail-page.tsx b/packages/views/autopilots/components/autopilot-detail-page.tsx
index 6c7f36dbd8..d250258728 100644
--- a/packages/views/autopilots/components/autopilot-detail-page.tsx
+++ b/packages/views/autopilots/components/autopilot-detail-page.tsx
@@ -27,6 +27,7 @@ import { BreadcrumbHeader } from "../../layout/breadcrumb-header";
import { ActorAvatar } from "../../common/actor-avatar";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Switch } from "@multica/ui/components/ui/switch";
import { cn } from "@multica/ui/lib/utils";
import { toast } from "sonner";
@@ -326,15 +327,15 @@ export function TriggerRow({ trigger, autopilotId, canWrite }: { trigger: Autopi
// trash icon visually floats above the URL action buttons because the
// outer flex uses `items-start`.
const deleteButton = canWrite ? (
- <Button
+ <IconButton
size="icon"
variant="ghost"
className="h-7 w-7 shrink-0"
onClick={() => setConfirmOpen(true)}
- title={t(($) => $.trigger_row.delete_dialog.confirm)}
+ label={t(($) => $.trigger_row.delete_dialog.confirm)}
>
<Trash2 className="h-3.5 w-3.5 text-muted-foreground" />
- </Button>
+ </IconButton>
) : null;
// Schedule rows only: cron and timezone are the fields this dialog edits, and
@@ -343,15 +344,15 @@ export function TriggerRow({ trigger, autopilotId, canWrite }: { trigger: Autopi
// an autopilot with two schedules has no editable schedule at all (MUL-7478).
const editButton =
canWrite && trigger.kind === "schedule" ? (
- <Button
+ <IconButton
size="icon"
variant="ghost"
className="h-7 w-7 shrink-0"
onClick={() => setEditOpen(true)}
- title={t(($) => $.trigger_row.edit_schedule)}
+ label={t(($) => $.trigger_row.edit_schedule)}
>
<Pencil className="h-3.5 w-3.5 text-muted-foreground" />
- </Button>
+ </IconButton>
) : null;
return (
@@ -413,16 +414,16 @@ export function TriggerRow({ trigger, autopilotId, canWrite }: { trigger: Autopi
actions={
<>
{canWrite && (
- <Button
+ <IconButton
size="icon"
variant="ghost"
className="h-7 w-7 shrink-0"
onClick={() => setRotateOpen(true)}
- title={t(($) => $.trigger_row.rotate_url)}
+ label={t(($) => $.trigger_row.rotate_url)}
disabled={rotateToken.isPending}
>
<RotateCw className={cn("h-3.5 w-3.5 text-muted-foreground", rotateToken.isPending && "animate-spin")} />
- </Button>
+ </IconButton>
)}
{deleteButton}
</>
diff --git a/packages/views/autopilots/components/autopilot-list-actions.tsx b/packages/views/autopilots/components/autopilot-list-actions.tsx
index 4823d134e2..f9c17b4fd6 100644
--- a/packages/views/autopilots/components/autopilot-list-actions.tsx
+++ b/packages/views/autopilots/components/autopilot-list-actions.tsx
@@ -18,6 +18,7 @@ import {
} from "@multica/core/autopilots";
import { useWorkspacePaths } from "@multica/core/paths";
import { Button } from "@multica/ui/components/ui/button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
Dialog,
DialogContent,
@@ -35,6 +36,7 @@ import {
} from "@multica/ui/components/ui/dropdown-menu";
import { useT } from "../../i18n";
import { useIntentNavigate } from "../../navigation";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
// Delete dialog — single row (kebab) and batch share one implementation.
@@ -159,15 +161,20 @@ export function AutopilotRowActions({ row }: { row: Autopilot }) {
className="flex items-center"
>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={t(($) => $.actions.row_menu)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
- >
- <MoreHorizontal className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.actions.row_menu)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.actions.row_menu)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ >
+ <MoreHorizontal className="size-4" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-48">
@@ -242,14 +249,16 @@ export function AutopilotBatchToolbar({
<span className="text-body font-medium">
{t(($) => $.actions.selected, { count: rows.length })}
</span>
- <button
- type="button"
- aria-label={t(($) => $.actions.clear_selection)}
- onClick={onClear}
- className="rounded-xs p-0.5 transition-colors hover:bg-accent"
- >
- <X className="size-3.5 text-muted-foreground" />
- </button>
+ <TooltipHint label={t(($) => $.actions.clear_selection)}>
+ <button
+ type="button"
+ aria-label={t(($) => $.actions.clear_selection)}
+ onClick={onClear}
+ className="rounded-xs p-0.5 transition-colors hover:bg-accent"
+ >
+ <X className="size-3.5 text-muted-foreground" />
+ </button>
+ </TooltipHint>
</div>
{anyActive && (
diff --git a/packages/views/autopilots/components/autopilot-list-toolbar.tsx b/packages/views/autopilots/components/autopilot-list-toolbar.tsx
index a66b825f7b..95c3b6f26f 100644
--- a/packages/views/autopilots/components/autopilot-list-toolbar.tsx
+++ b/packages/views/autopilots/components/autopilot-list-toolbar.tsx
@@ -18,6 +18,7 @@ import {
} from "@multica/core/autopilots/stores";
import { useActorName } from "@multica/core/workspace/hooks";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuCheckboxItem,
@@ -511,7 +512,7 @@ export function AutopilotListToolbar({
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
- <Button
+ <IconButton
variant="outline"
size="icon-sm"
onClick={() =>
@@ -519,7 +520,7 @@ export function AutopilotListToolbar({
sortDirection === "asc" ? "desc" : "asc",
)
}
- title={
+ label={
sortDirection === "asc"
? t(($) => $.toolbar.direction_asc)
: t(($) => $.toolbar.direction_desc)
@@ -530,7 +531,7 @@ export function AutopilotListToolbar({
) : (
<ArrowDown className="size-3.5" />
)}
- </Button>
+ </IconButton>
</div>
</div>
diff --git a/packages/views/autopilots/components/subscriber-multi-select.tsx b/packages/views/autopilots/components/subscriber-multi-select.tsx
index 589fdd5433..a49082ed76 100644
--- a/packages/views/autopilots/components/subscriber-multi-select.tsx
+++ b/packages/views/autopilots/components/subscriber-multi-select.tsx
@@ -6,6 +6,7 @@ import { useQuery } from "@tanstack/react-query";
import { useWorkspaceId } from "@multica/core/hooks";
import { memberListOptions } from "@multica/core/workspace/queries";
import { cn } from "@multica/ui/lib/utils";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { ActorAvatar } from "../../common/actor-avatar";
import {
PropertyPicker,
@@ -72,14 +73,16 @@ export function SubscriberMultiSelect({
>
<ActorAvatar actorType="member" actorId={m.user_id} size="xs" />
<span className="max-w-[10rem] truncate">{m.name}</span>
- <button
- type="button"
- onClick={() => remove(m.user_id)}
- className="text-muted-foreground hover:text-foreground transition-colors cursor-pointer"
- aria-label={t(($) => $.dialog.subscribers_remove_tooltip)}
- >
- <X className="size-3" />
- </button>
+ <TooltipHint label={t(($) => $.dialog.subscribers_remove_tooltip)}>
+ <button
+ type="button"
+ onClick={() => remove(m.user_id)}
+ className="text-muted-foreground hover:text-foreground transition-colors cursor-pointer"
+ aria-label={t(($) => $.dialog.subscribers_remove_tooltip)}
+ >
+ <X className="size-3" />
+ </button>
+ </TooltipHint>
</span>
))}
<PropertyPicker
diff --git a/packages/views/autopilots/components/webhook-event-filter-section.tsx b/packages/views/autopilots/components/webhook-event-filter-section.tsx
index d8526188d3..f5e740701f 100644
--- a/packages/views/autopilots/components/webhook-event-filter-section.tsx
+++ b/packages/views/autopilots/components/webhook-event-filter-section.tsx
@@ -3,6 +3,7 @@
import { useState } from "react";
import { X, Plus, Filter, ExternalLink } from "lucide-react";
import { cn } from "@multica/ui/lib/utils";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import type { WebhookEventFilter } from "@multica/core/types";
import { useT } from "../../i18n";
@@ -74,15 +75,16 @@ export function WebhookEventFilterSection({
: {f.actions.join(", ")}
</span>
)}
- <button
- type="button"
- onClick={() => removeFilter(idx)}
- aria-label={t(($) => $.dialog.event_filter_remove_label)}
- title={t(($) => $.dialog.event_filter_remove_label)}
- className="ml-auto rounded-xs p-0.5 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
- >
- <X className="size-3" />
- </button>
+ <TooltipHint label={t(($) => $.dialog.event_filter_remove_label)}>
+ <button
+ type="button"
+ onClick={() => removeFilter(idx)}
+ aria-label={t(($) => $.dialog.event_filter_remove_label)}
+ className="ml-auto rounded-xs p-0.5 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
+ >
+ <X className="size-3" />
+ </button>
+ </TooltipHint>
</div>
))}
</div>
diff --git a/packages/views/autopilots/components/webhook-url-field.tsx b/packages/views/autopilots/components/webhook-url-field.tsx
index c65b01b3c0..7f8e567ca5 100644
--- a/packages/views/autopilots/components/webhook-url-field.tsx
+++ b/packages/views/autopilots/components/webhook-url-field.tsx
@@ -4,10 +4,11 @@ import { useState, type ReactNode } from "react";
import { Check, Copy, Eye, EyeOff } from "lucide-react";
import { toast } from "sonner";
import { maskAutopilotWebhookUrl } from "@multica/core/autopilots";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
import { useT } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
const SIZES = {
// Trigger row on the detail page — compact, sits inline with the row actions.
@@ -81,44 +82,43 @@ export function WebhookUrlField({ url, size = "sm", actions }: WebhookUrlFieldPr
// Click-to-reveal lives on the value itself. Once revealed it goes back
// to plain text so the URL stays selectable — a toggle button there
// would swallow the drag-select.
- <button
- type="button"
- onClick={() => setRevealedUrl(url)}
- className={cn(valueClassName, "text-left cursor-pointer transition-colors hover:bg-muted/70")}
- title={t(($) => $.trigger_row.show_url)}
- aria-label={t(($) => $.trigger_row.hidden_url_aria)}
- >
- {maskAutopilotWebhookUrl(url)}
- </button>
+ <TooltipHint label={t(($) => $.trigger_row.show_url)}>
+ <button
+ type="button"
+ onClick={() => setRevealedUrl(url)}
+ className={cn(valueClassName, "text-left cursor-pointer transition-colors hover:bg-muted/70")}
+ aria-label={t(($) => $.trigger_row.hidden_url_aria)}
+ >
+ {maskAutopilotWebhookUrl(url)}
+ </button>
+ </TooltipHint>
)}
- <Button
+ <IconButton
size="icon"
variant={s.buttonVariant}
className={cn("shrink-0", s.button)}
onClick={() => setRevealedUrl(revealed ? null : url)}
- title={revealed ? t(($) => $.trigger_row.hide_url) : t(($) => $.trigger_row.show_url)}
- aria-label={revealed ? t(($) => $.trigger_row.hide_url) : t(($) => $.trigger_row.show_url)}
+ label={revealed ? t(($) => $.trigger_row.hide_url) : t(($) => $.trigger_row.show_url)}
>
{revealed ? (
<EyeOff className={cn(s.icon, "text-muted-foreground")} />
) : (
<Eye className={cn(s.icon, "text-muted-foreground")} />
)}
- </Button>
- <Button
+ </IconButton>
+ <IconButton
size="icon"
variant={s.buttonVariant}
className={cn("shrink-0", s.button)}
onClick={handleCopy}
- title={t(($) => $.trigger_row.copy_url)}
- aria-label={t(($) => $.trigger_row.copy_url)}
+ label={t(($) => $.trigger_row.copy_url)}
>
{copied ? (
<Check className={cn(s.icon, "text-emerald-500")} />
) : (
<Copy className={cn(s.icon, "text-muted-foreground")} />
)}
- </Button>
+ </IconButton>
{actions}
</div>
);
diff --git a/packages/views/chat/components/chat-add-menu.tsx b/packages/views/chat/components/chat-add-menu.tsx
index c2e135394b..4f02d420d6 100644
--- a/packages/views/chat/components/chat-add-menu.tsx
+++ b/packages/views/chat/components/chat-add-menu.tsx
@@ -2,7 +2,7 @@
import { useRef } from "react";
import { Check, FolderKanban, Image as ImageIcon, Plus, X } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuTrigger,
@@ -60,17 +60,16 @@ export function ChatAddMenu({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
disabled={disabled}
- aria-label={t(($) => $.input.add_tooltip)}
- title={t(($) => $.input.add_tooltip)}
+ label={t(($) => $.input.add_tooltip)}
className="rounded-full text-muted-foreground"
>
<Plus />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="start" side="top" sideOffset={6}>
diff --git a/packages/views/chat/components/chat-input.test.tsx b/packages/views/chat/components/chat-input.test.tsx
index 59a9213906..43b6c341db 100644
--- a/packages/views/chat/components/chat-input.test.tsx
+++ b/packages/views/chat/components/chat-input.test.tsx
@@ -1012,12 +1012,19 @@ describe("ChatInput attachment wiring", () => {
// While the upload is pending the SubmitButton must be disabled.
// Bypassing this would send the message with the attachment id
- // missing from the body.
+ // missing from the body. It is aria-disabled rather than natively
+ // disabled so its "uploading" tooltip stays reachable.
await waitFor(() => {
const buttons = screen.getAllByRole("button");
const sendButton = buttons[buttons.length - 1]!;
- expect(sendButton).toBeDisabled();
+ expect(sendButton).toHaveAttribute("aria-disabled", "true");
+ expect(sendButton).toHaveAttribute("aria-busy", "true");
});
+ {
+ const buttons = screen.getAllByRole("button");
+ fireEvent.click(buttons[buttons.length - 1]!);
+ }
+ expect(onSend).not.toHaveBeenCalled();
await act(async () => {
resolveUpload!(makeUpload({ id: "att-slow", link: "https://cdn.example/att-slow.png", filename: "slow.png" }));
@@ -1651,3 +1658,31 @@ describe("ChatInput revoked-access placeholder", () => {
expect(editorProps.last?.placeholder).toBe("Message Multica…");
});
});
+
+// A natively disabled send button takes no hover or focus, so the reason it is
+// blocked would never reach its tooltip; the blocked composer keeps it
+// aria-disabled and names the same reason as the placeholder.
+describe("ChatInput send disabled reason", () => {
+ function sendButton() {
+ const buttons = screen.getAllByRole("button");
+ return buttons[buttons.length - 1]!;
+ }
+
+ it("keeps the send button reachable and describes why it is blocked", () => {
+ const onSend = vi.fn();
+ renderInput({ disabled: true, agentArchived: true, onSend });
+
+ const button = sendButton();
+ expect(button).toHaveAttribute("aria-disabled", "true");
+ expect(button).not.toBeDisabled();
+ fireEvent.click(button);
+ expect(onSend).not.toHaveBeenCalled();
+ });
+
+ it("stays natively disabled when the composer is only empty", () => {
+ renderInput({ agentName: "Multica" });
+
+ expect(sendButton()).toBeDisabled();
+ expect(sendButton()).not.toHaveAttribute("aria-disabled");
+ });
+});
diff --git a/packages/views/chat/components/chat-input.tsx b/packages/views/chat/components/chat-input.tsx
index 84144d8fc9..fcf3b9806e 100644
--- a/packages/views/chat/components/chat-input.tsx
+++ b/packages/views/chat/components/chat-input.tsx
@@ -24,7 +24,8 @@ import { CHAT_COLUMN, CHAT_GUTTER } from "./chat-column";
import { useChatStore, DRAFT_NEW_SESSION } from "@multica/core/chat";
import { attachmentToDraftUpload, type DraftUpload } from "@multica/core/drafts";
import { createLogger } from "@multica/core/logger";
-import { formatShortcut, useShortcut } from "@multica/core/shortcuts";
+import { useShortcut } from "@multica/core/shortcuts";
+import { ShortcutKeycaps } from "../../common/shortcut-keycaps";
import type { MentionItem } from "../../editor/extensions/mention-suggestion";
import type { Attachment, Project } from "@multica/core/types";
import { ProjectPicker } from "../../projects/components/project-picker";
@@ -773,13 +774,22 @@ export function ChatInput({
(!allowSubmitWhileRunning || hasNothingToSend || gate.uploading)
}
onStop={onStop}
- tooltip={gate.uploading
+ // While blocked, the placeholder copy is exactly the reason.
+ disabledReason={gate.uploading
? tEditor(($) => $.upload.in_progress)
- : isRunning
- ? t(($) => $.input.queue_send_tooltip)
- : sendShortcut
- ? `${t(($) => $.input.send_tooltip)} · ${formatShortcut(sendShortcut)}`
- : t(($) => $.input.send_tooltip)}
+ : disabled || noAgent
+ ? placeholder
+ : undefined}
+ tooltip={isRunning
+ ? t(($) => $.input.queue_send_tooltip)
+ : sendShortcut
+ ? (
+ <>
+ {t(($) => $.input.send_tooltip)}
+ <ShortcutKeycaps shortcut={sendShortcut} decorative />
+ </>
+ )
+ : t(($) => $.input.send_tooltip)}
ariaLabel={gate.uploading
? tEditor(($) => $.upload.in_progress)
: isRunning
diff --git a/packages/views/chat/components/chat-queue.tsx b/packages/views/chat/components/chat-queue.tsx
index a936d656a9..151ecbb534 100644
--- a/packages/views/chat/components/chat-queue.tsx
+++ b/packages/views/chat/components/chat-queue.tsx
@@ -11,6 +11,7 @@ import {
} from "lucide-react";
import type { ChatQueuedTask } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuContent,
@@ -143,13 +144,12 @@ export function ChatQueue({
{t(($) => $.queue.steer)}
</Button>
</span>
- <Button
+ <IconButton
variant="ghost"
size="icon-xs"
className="shrink-0 text-muted-foreground"
disabled={busyAction !== null}
- title={t(($) => $.queue.remove)}
- aria-label={t(($) => $.queue.remove)}
+ label={t(($) => $.queue.remove)}
onClick={() => void run(removeKey, () => onRemove(task.task_id))}
>
{busyAction === removeKey ? (
@@ -157,18 +157,17 @@ export function ChatQueue({
) : (
<Trash2 aria-hidden="true" />
)}
- </Button>
+ </IconButton>
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
className="shrink-0 text-muted-foreground"
disabled={busyAction !== null}
- title={t(($) => $.queue.more)}
- aria-label={t(($) => $.queue.more)}
+ label={t(($) => $.queue.more)}
/>
}
>
diff --git a/packages/views/chat/components/chat-session-header.test.tsx b/packages/views/chat/components/chat-session-header.test.tsx
index 357721cc4d..4658de2b30 100644
--- a/packages/views/chat/components/chat-session-header.test.tsx
+++ b/packages/views/chat/components/chat-session-header.test.tsx
@@ -59,7 +59,7 @@ function startRename(): HTMLInputElement {
<button type="button">{OUTSIDE_LABEL}</button>
</>,
);
- fireEvent.click(screen.getByTitle(RENAME_LABEL));
+ fireEvent.click(screen.getByRole("button", { name: "Original title" }));
return screen.getByRole("textbox", { name: RENAME_LABEL });
}
diff --git a/packages/views/chat/components/chat-session-header.tsx b/packages/views/chat/components/chat-session-header.tsx
index 126e87db02..2a6f00adb6 100644
--- a/packages/views/chat/components/chat-session-header.tsx
+++ b/packages/views/chat/components/chat-session-header.tsx
@@ -2,7 +2,7 @@
import { useEffect, useRef, useState } from "react";
import { Archive, ArchiveRestore, MoreHorizontal, Pencil, Trash2, UserRound } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuTrigger,
@@ -32,6 +32,7 @@ import { isImeComposing } from "@multica/core/utils";
import { ActorAvatar } from "../../common/actor-avatar";
import { AppLink } from "../../navigation";
import { useT } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
/**
* Per-session header for the conversation pane: agent avatar + editable chat
@@ -52,6 +53,7 @@ export function ChatSessionHeader({
onArchive?: (session: ChatSession) => void;
}) {
const { t } = useT("chat");
+ const { t: tCommon } = useT("common");
const wsPaths = useWorkspacePaths();
const updateSession = useUpdateChatSession();
const deleteSession = useDeleteChatSession();
@@ -190,14 +192,15 @@ export function ChatSessionHeader({
className="w-full rounded-sm bg-background px-1 py-0.5 text-body font-semibold outline-none ring-1 ring-border focus-visible:ring-brand"
/>
) : (
- <button
- type="button"
- onClick={startRename}
- title={t(($) => $.header.rename)}
- className="block max-w-full truncate text-left text-body font-semibold text-foreground outline-none hover:text-foreground/80 focus-visible:text-foreground/80"
- >
- {title}
- </button>
+ <TooltipHint label={t(($) => $.header.rename)}>
+ <button
+ type="button"
+ onClick={startRename}
+ className="block max-w-full truncate text-left text-body font-semibold text-foreground outline-none hover:text-foreground/80 focus-visible:text-foreground/80"
+ >
+ {title}
+ </button>
+ </TooltipHint>
)}
{agent && (
<div className="truncate text-caption text-muted-foreground">
@@ -209,7 +212,13 @@ export function ChatSessionHeader({
<DropdownMenu>
<DropdownMenuTrigger
- render={<Button variant="ghost" size="icon-sm" className="text-muted-foreground" />}
+ render={
+ <IconButton
+ label={tCommon(($) => $.more_actions)}
+ tooltipSide="bottom"
+ className="text-muted-foreground"
+ />
+ }
>
<MoreHorizontal className="h-4 w-4" />
</DropdownMenuTrigger>
diff --git a/packages/views/chat/components/chat-thread-list.tsx b/packages/views/chat/components/chat-thread-list.tsx
index 3ddd2eed86..1d5d760e0d 100644
--- a/packages/views/chat/components/chat-thread-list.tsx
+++ b/packages/views/chat/components/chat-thread-list.tsx
@@ -28,6 +28,7 @@ import {
import { useChatStore } from "@multica/core/chat";
import type { Agent, ChatSession, PendingChatTasksResponse } from "@multica/core/types";
import { ActorAvatar } from "../../common/actor-avatar";
+import { DeferredTooltip } from "../../common/deferred-tooltip";
import {
RowActionsMenu,
handleRowActivationKey,
@@ -545,28 +546,32 @@ function RowAction({
danger?: boolean;
}) {
return (
- <button
- type="button"
- aria-label={label}
- title={label}
- onPointerDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- }}
- onClick={(e) => {
- e.stopPropagation();
- e.preventDefault();
- onClick();
- }}
- className={cn(
- "inline-flex size-7 items-center justify-center rounded-xs text-muted-foreground transition-colors focus-visible:outline-none",
- danger
- ? "hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive"
- : "hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
- )}
- >
- {icon}
- </button>
+ <DeferredTooltip
+ content={label}
+ trigger={
+ <button
+ type="button"
+ aria-label={label}
+ onPointerDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ onClick={(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ onClick();
+ }}
+ className={cn(
+ "inline-flex size-7 items-center justify-center rounded-xs text-muted-foreground transition-colors focus-visible:outline-none",
+ danger
+ ? "hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive"
+ : "hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
+ )}
+ >
+ {icon}
+ </button>
+ }
+ />
);
}
diff --git a/packages/views/chat/components/chat-window.tsx b/packages/views/chat/components/chat-window.tsx
index b3fe2ef50e..1b81470d21 100644
--- a/packages/views/chat/components/chat-window.tsx
+++ b/packages/views/chat/components/chat-window.tsx
@@ -26,6 +26,8 @@ import {
useWorkspaceAgentAvailability,
} from "@multica/core/agents";
import { ActorAvatar } from "../../common/actor-avatar";
+import { DeferredTooltip } from "../../common/deferred-tooltip";
+import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";
import { useAppForeground } from "../../common/use-app-foreground";
import {
RowActionsMenu,
@@ -874,7 +876,10 @@ export function ChatWindow() {
>
<Minus />
</TooltipTrigger>
- <TooltipContent side="top">{t(($) => $.window.minimize_tooltip)}</TooltipContent>
+ <TooltipContent side="top">
+ {t(($) => $.window.minimize_tooltip)}
+ <ActionShortcutKeycaps action="toggleChat" />
+ </TooltipContent>
</Tooltip>
</div>
</div>
@@ -1493,31 +1498,33 @@ function SessionDropdown({
groups={[rowActions]}
/>
<div className="hidden h-7 items-center gap-0.5 [@media(hover:hover)]:group-hover/history-row:flex [@media(hover:hover)]:group-focus-within/history-row:flex">
- {rowActions.map((action) => (
- <button
- key={action.key}
- type="button"
- onPointerDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- }}
- onClick={(e) => {
- e.stopPropagation();
- e.preventDefault();
- action.onSelect();
- }}
- className={
- action.danger
- ? "inline-flex h-7 items-center gap-1 rounded-xs px-1.5 text-micro font-medium text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive focus-visible:outline-none"
- : "inline-flex size-7 items-center justify-center rounded-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground focus-visible:outline-none"
- }
- aria-label={action.label}
- title={action.label}
- >
- {action.icon}
- {action.stripText}
- </button>
- ))}
+ {rowActions.map((action) => {
+ const button = (
+ <button
+ key={action.key}
+ type="button"
+ onPointerDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ onClick={(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ action.onSelect();
+ }}
+ className={
+ action.danger
+ ? "inline-flex h-7 items-center gap-1 rounded-xs px-1.5 text-micro font-medium text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive focus-visible:outline-none"
+ : "inline-flex size-7 items-center justify-center rounded-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground focus-visible:outline-none"
+ }
+ aria-label={action.label}
+ >
+ {action.icon}
+ {action.stripText}
+ </button>
+ );
+ return <DeferredTooltip key={action.key} content={action.label} trigger={button} />;
+ })}
</div>
</div>
)
diff --git a/packages/views/chat/components/new-chat-button.tsx b/packages/views/chat/components/new-chat-button.tsx
index 89922e53f5..11702c7b25 100644
--- a/packages/views/chat/components/new-chat-button.tsx
+++ b/packages/views/chat/components/new-chat-button.tsx
@@ -3,6 +3,7 @@
import React, { useMemo, useState } from "react";
import { Plus } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import { ActorAvatar } from "../../common/actor-avatar";
import {
@@ -30,6 +31,7 @@ export function AgentPicker({
onSelect,
trigger,
triggerRender,
+ tooltip,
side = "bottom",
align = "start",
}: {
@@ -39,6 +41,7 @@ export function AgentPicker({
onSelect: (agent: Agent) => void;
trigger: React.ReactNode;
triggerRender: React.ReactElement;
+ tooltip?: React.ReactNode;
side?: "top" | "bottom";
align?: "start" | "center" | "end";
}) {
@@ -78,6 +81,7 @@ export function AgentPicker({
onSearchChange={setFilter}
triggerRender={triggerRender}
trigger={trigger}
+ tooltip={tooltip}
>
{filteredMine.length === 0 && filteredOthers.length === 0 ? (
<PickerEmpty />
@@ -208,11 +212,12 @@ export function NewChatButton({
side={side}
align="start"
triggerRender={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
className="rounded-full text-muted-foreground"
- aria-label={label}
+ label={label}
+ tooltipSide={side === "top" ? "top" : "bottom"}
/>
}
trigger={<Plus />}
diff --git a/packages/views/chat/components/quick-agent-bar.tsx b/packages/views/chat/components/quick-agent-bar.tsx
index 114985f40a..8005a6b007 100644
--- a/packages/views/chat/components/quick-agent-bar.tsx
+++ b/packages/views/chat/components/quick-agent-bar.tsx
@@ -97,6 +97,7 @@ export function QuickAgentBar({
onSelect={(agent) => pin.mutate(agent.id)}
side="bottom"
align="start"
+ tooltip={t(($) => $.list.add_agent)}
triggerRender={
<button
type="button"
diff --git a/packages/views/common/avatar-crop-dialog.tsx b/packages/views/common/avatar-crop-dialog.tsx
index db65924f06..7298fe1ec6 100644
--- a/packages/views/common/avatar-crop-dialog.tsx
+++ b/packages/views/common/avatar-crop-dialog.tsx
@@ -5,6 +5,7 @@ import Cropper, { type Area, type Point } from "react-easy-crop";
import { Loader2, Minus, Plus, RotateCw } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
import { Slider } from "@multica/ui/components/ui/slider";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
Dialog,
DialogContent,
@@ -142,15 +143,17 @@ export function AvatarCropDialog({
setCroppedAreaPixels(areaPixels)
}
/>
- <button
- type="button"
- onClick={() => setRotation((r) => (r + 90) % 360)}
- disabled={busy}
- aria-label={t(($) => $.avatar_crop.rotate)}
- className="absolute right-2 top-2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background disabled:opacity-50"
- >
- <RotateCw className="h-4 w-4" />
- </button>
+ <TooltipHint label={t(($) => $.avatar_crop.rotate)}>
+ <button
+ type="button"
+ onClick={() => setRotation((r) => (r + 90) % 360)}
+ disabled={busy}
+ aria-label={t(($) => $.avatar_crop.rotate)}
+ className="absolute right-2 top-2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background disabled:opacity-50"
+ >
+ <RotateCw className="h-4 w-4" />
+ </button>
+ </TooltipHint>
</>
) : (
<div className="flex h-full w-full items-center justify-center text-caption text-muted-foreground">
@@ -162,15 +165,17 @@ export function AvatarCropDialog({
</div>
<div className="flex items-center gap-3">
- <button
- type="button"
- onClick={() => setZoom((z) => clampZoom(z - ZOOM_STEP))}
- disabled={disabled}
- aria-label={t(($) => $.avatar_crop.zoom_out)}
- className="shrink-0 text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40"
- >
- <Minus className="h-4 w-4" />
- </button>
+ <TooltipHint label={t(($) => $.avatar_crop.zoom_out)}>
+ <button
+ type="button"
+ onClick={() => setZoom((z) => clampZoom(z - ZOOM_STEP))}
+ disabled={disabled}
+ aria-label={t(($) => $.avatar_crop.zoom_out)}
+ className="shrink-0 text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40"
+ >
+ <Minus className="h-4 w-4" />
+ </button>
+ </TooltipHint>
<Slider
value={[zoom]}
min={MIN_ZOOM}
@@ -183,15 +188,17 @@ export function AvatarCropDialog({
aria-label={t(($) => $.avatar_crop.zoom)}
className="flex-1"
/>
- <button
- type="button"
- onClick={() => setZoom((z) => clampZoom(z + ZOOM_STEP))}
- disabled={disabled}
- aria-label={t(($) => $.avatar_crop.zoom_in)}
- className="shrink-0 text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40"
- >
- <Plus className="h-4 w-4" />
- </button>
+ <TooltipHint label={t(($) => $.avatar_crop.zoom_in)}>
+ <button
+ type="button"
+ onClick={() => setZoom((z) => clampZoom(z + ZOOM_STEP))}
+ disabled={disabled}
+ aria-label={t(($) => $.avatar_crop.zoom_in)}
+ className="shrink-0 text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40"
+ >
+ <Plus className="h-4 w-4" />
+ </button>
+ </TooltipHint>
</div>
<div className="flex items-center justify-between">
diff --git a/packages/views/common/avatar-upload-control.tsx b/packages/views/common/avatar-upload-control.tsx
index 561a6f00d0..80fef65115 100644
--- a/packages/views/common/avatar-upload-control.tsx
+++ b/packages/views/common/avatar-upload-control.tsx
@@ -17,6 +17,8 @@ import {
PopoverTrigger,
} from "@multica/ui/components/ui/popover";
import { Separator } from "@multica/ui/components/ui/separator";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../i18n";
import { AvatarCropDialog } from "./avatar-crop-dialog";
@@ -212,6 +214,8 @@ export function AvatarUploadControl({
//
// No success toast on purpose: the avatar swaps to the chosen emoji in place,
// so the change is already visible.
+ const changeLabel = ariaLabel ?? t(($) => $.avatar_upload.change);
+
const handleEmojiSelected = async (picked: string) => {
closePicker();
setPreviewError(false);
@@ -233,7 +237,7 @@ export function AvatarUploadControl({
// file dialog, which is this control's original single-purpose shape.
onClick={emojiEnabled ? undefined : openFileDialog}
disabled={disabled || busy}
- aria-label={ariaLabel ?? t(($) => $.avatar_upload.change)}
+ aria-label={changeLabel}
className={cn(
"group relative h-full w-full overflow-hidden bg-muted text-muted-foreground outline-none",
"flex items-center justify-center",
@@ -280,7 +284,10 @@ export function AvatarUploadControl({
<div className="relative shrink-0" style={{ width: size, height: size }}>
{emojiEnabled ? (
<Popover open={pickerOpen} onOpenChange={handlePickerOpenChange}>
- <PopoverTrigger render={avatarButton} />
+ <DeferredTooltip
+ content={changeLabel}
+ trigger={<PopoverTrigger render={avatarButton} />}
+ />
<PopoverContent
align="start"
// The emoji-mart picker sizes itself; only the suggestion grid is
@@ -348,22 +355,24 @@ export function AvatarUploadControl({
</PopoverContent>
</Popover>
) : (
- avatarButton
+ <DeferredTooltip content={changeLabel} trigger={avatarButton} />
)}
{onClear && hasAvatar && !busy && !disabled && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- setPreviewError(false);
- onClear();
- }}
- className="absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border bg-background text-muted-foreground shadow-sm transition-colors hover:bg-muted hover:text-foreground"
- aria-label={t(($) => $.avatar_upload.remove)}
- >
- <X className="h-3 w-3" />
- </button>
+ <TooltipHint label={t(($) => $.avatar_upload.remove)}>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ setPreviewError(false);
+ onClear();
+ }}
+ className="absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border bg-background text-muted-foreground shadow-sm transition-colors hover:bg-muted hover:text-foreground"
+ aria-label={t(($) => $.avatar_upload.remove)}
+ >
+ <X className="h-3 w-3" />
+ </button>
+ </TooltipHint>
)}
<input
diff --git a/packages/views/common/color-picker.tsx b/packages/views/common/color-picker.tsx
index 7c74442d48..e3ed8d93db 100644
--- a/packages/views/common/color-picker.tsx
+++ b/packages/views/common/color-picker.tsx
@@ -7,7 +7,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "@multica/ui/components/ui/popover";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../i18n";
@@ -200,16 +200,15 @@ export function ColorPickerPanel({
{/* Eyedropper + hue slider */}
<div className="flex items-center gap-2.5">
{eyedropperSupported && (
- <Button
+ <IconButton
type="button"
variant="outline"
size="icon-sm"
- aria-label={t(($) => $.color_picker.eyedropper)}
- title={t(($) => $.color_picker.eyedropper)}
+ label={t(($) => $.color_picker.eyedropper)}
onClick={pickFromScreen}
>
<Pipette className="size-3.5" />
- </Button>
+ </IconButton>
)}
<div
role="slider"
diff --git a/packages/views/common/date-only-picker.tsx b/packages/views/common/date-only-picker.tsx
index aa89982762..b96bad1181 100644
--- a/packages/views/common/date-only-picker.tsx
+++ b/packages/views/common/date-only-picker.tsx
@@ -14,6 +14,7 @@ import {
PopoverTrigger,
PopoverContent,
} from "@multica/ui/components/ui/popover";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
import { DeferredPopup } from "./deferred-popup";
import { useLocale } from "../i18n";
@@ -41,6 +42,8 @@ interface DateOnlyPickerProps {
trigger?: React.ReactNode;
/** Custom trigger element (e.g. a pill button). */
triggerRender?: React.ReactElement<Record<string, unknown>>;
+ /** Hover tooltip naming the field; hidden while the popover is open. */
+ tooltip?: React.ReactNode;
/** Controlled open state — lets a ⋯ overflow menu reveal + open the pill. */
open?: boolean;
onOpenChange?: (v: boolean) => void;
@@ -76,6 +79,7 @@ export function DateOnlyPicker(props: DateOnlyPickerProps) {
trigger={props.trigger ?? <DateTriggerContent {...props} />}
triggerRender={props.triggerRender}
triggerClassName={DATE_TRIGGER_CLASS}
+ tooltip={props.tooltip}
>
{(open, onOpenChange) => (
<DateOnlyPickerImpl {...props} open={open} onOpenChange={onOpenChange} />
@@ -117,6 +121,7 @@ function DateOnlyPickerImpl({
highlightOverdue = false,
trigger: customTrigger,
triggerRender,
+ tooltip,
open: controlledOpen,
onOpenChange: controlledOnOpenChange,
align = "start",
@@ -127,21 +132,29 @@ function DateOnlyPickerImpl({
const setOpen = controlledOnOpenChange ?? setInternalOpen;
const date = dateOnlyToLocalDate(value);
+ const popoverTrigger = (
+ <PopoverTrigger
+ className={triggerRender ? undefined : DATE_TRIGGER_CLASS}
+ render={triggerRender}
+ >
+ {customTrigger ?? (
+ <DateTriggerContent
+ value={value}
+ icon={icon}
+ placeholder={placeholder}
+ highlightOverdue={highlightOverdue}
+ />
+ )}
+ </PopoverTrigger>
+ );
+
return (
<Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger
- className={triggerRender ? undefined : DATE_TRIGGER_CLASS}
- render={triggerRender}
- >
- {customTrigger ?? (
- <DateTriggerContent
- value={value}
- icon={icon}
- placeholder={placeholder}
- highlightOverdue={highlightOverdue}
- />
- )}
- </PopoverTrigger>
+ {tooltip == null ? (
+ popoverTrigger
+ ) : (
+ <DeferredTooltip trigger={popoverTrigger} content={tooltip} />
+ )}
<PopoverContent className="w-auto p-0" align={align}>
{/* Empty value first, above the calendar — the same position every
list-backed picker puts it in, so clearing a field is always the
diff --git a/packages/views/common/deferred-popup.tsx b/packages/views/common/deferred-popup.tsx
index 6cf25fcc4a..1dd9f07d6f 100644
--- a/packages/views/common/deferred-popup.tsx
+++ b/packages/views/common/deferred-popup.tsx
@@ -1,6 +1,7 @@
"use client";
import { cloneElement, useState, type ReactElement, type ReactNode } from "react";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
/**
* Defers mounting a popup component (Popover/Menu root + trigger machinery)
@@ -33,6 +34,8 @@ export function DeferredPopup({
triggerRender,
triggerClassName,
ariaHasPopup = "dialog",
+ tooltip,
+ tooltipSide,
children,
}: {
/** Trigger content, matching what the host passes to its popup trigger. */
@@ -48,6 +51,10 @@ export function DeferredPopup({
/** ARIA popup kind of the real trigger ("dialog" for popovers, "menu" for
* dropdown menus) so the cold trigger reads the same to assistive tech. */
ariaHasPopup?: "dialog" | "menu";
+ /** Hover tooltip for the cold trigger. Pass the same content to the real
+ * component so the tooltip survives the upgrade. */
+ tooltip?: ReactNode;
+ tooltipSide?: "top" | "bottom" | "left" | "right";
/** Renders the real component once upgraded. */
children: (open: boolean, onOpenChange: (v: boolean) => void) => ReactNode;
}) {
@@ -79,18 +86,22 @@ export function DeferredPopup({
"aria-haspopup": ariaHasPopup,
};
+ let cold: ReactElement<Record<string, unknown>>;
if (triggerRender) {
// Mirror Base UI's render-prop semantics: the render element's own
// children win over the component-level trigger content.
- if (triggerRender.props.children != null) {
- return cloneElement(triggerRender, handlers);
- }
- return cloneElement(triggerRender, handlers, trigger);
+ cold =
+ triggerRender.props.children != null
+ ? cloneElement(triggerRender, handlers)
+ : cloneElement(triggerRender, handlers, trigger);
+ } else {
+ cold = (
+ <button type="button" className={triggerClassName} {...handlers}>
+ {trigger}
+ </button>
+ );
}
- return (
- <button type="button" className={triggerClassName} {...handlers}>
- {trigger}
- </button>
- );
+ if (tooltip == null) return cold;
+ return <DeferredTooltip trigger={cold} content={tooltip} side={tooltipSide} />;
}
diff --git a/packages/views/common/deferred-tooltip.tsx b/packages/views/common/deferred-tooltip.tsx
index ce5e94b13c..c8b4247182 100644
--- a/packages/views/common/deferred-tooltip.tsx
+++ b/packages/views/common/deferred-tooltip.tsx
@@ -1,86 +1 @@
-"use client";
-
-import {
- cloneElement,
- useEffect,
- useRef,
- useState,
- type ReactElement,
- type ReactNode,
-} from "react";
-import { Tooltip, TooltipContent } from "@multica/ui/components/ui/tooltip";
-
-// Matches the ui TooltipProvider default delay so the deferred first-open
-// feels identical to a native tooltip.
-const TOOLTIP_OPEN_DELAY = 200;
-
-/**
- * Tooltip whose machinery mounts only on first hover.
- *
- * Dense grids (board/swimlane column headers) mount hundreds of tooltip
- * roots that are almost never hovered — a measurable slice of surface mount
- * cost. This wrapper renders ONLY the trigger element until the pointer
- * first enters it, then mounts a controlled Tooltip anchored to that same
- * element.
- *
- * Unlike a trigger-swap approach, the trigger element is rendered by this
- * component in the same tree position before and after warming — its DOM
- * node is preserved, so mid-gesture events (the hover's own click) never
- * land on a detached node. Hover open/close is driven here (timer on enter,
- * close on leave); the popup positions against the trigger via an anchor
- * ref instead of a Base UI trigger wrapper.
- */
-export function DeferredTooltip({
- trigger,
- content,
- side,
-}: {
- /** The visible trigger element (e.g. an icon button). Cloned with hover
- * handlers and an anchor ref; its own props are preserved. */
- trigger: ReactElement<Record<string, unknown>>;
- content: ReactNode;
- side?: "top" | "bottom" | "left" | "right";
-}) {
- const anchorRef = useRef<HTMLElement | null>(null);
- const [warm, setWarm] = useState(false);
- const [open, setOpen] = useState(false);
- const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
-
- const clearTimer = () => {
- if (timerRef.current !== null) {
- clearTimeout(timerRef.current);
- timerRef.current = null;
- }
- };
- useEffect(() => clearTimer, []);
-
- const element = cloneElement(trigger, {
- ref: (el: HTMLElement | null) => {
- anchorRef.current = el;
- },
- onPointerEnter: (e: React.PointerEvent) => {
- (trigger.props.onPointerEnter as ((e: React.PointerEvent) => void) | undefined)?.(e);
- setWarm(true);
- clearTimer();
- timerRef.current = setTimeout(() => setOpen(true), TOOLTIP_OPEN_DELAY);
- },
- onPointerLeave: (e: React.PointerEvent) => {
- (trigger.props.onPointerLeave as ((e: React.PointerEvent) => void) | undefined)?.(e);
- clearTimer();
- setOpen(false);
- },
- });
-
- return (
- <>
- {element}
- {warm && (
- <Tooltip open={open} onOpenChange={setOpen}>
- <TooltipContent side={side} anchor={anchorRef}>
- {content}
- </TooltipContent>
- </Tooltip>
- )}
- </>
- );
-}
+export { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
diff --git a/packages/views/common/mcp-server-row.tsx b/packages/views/common/mcp-server-row.tsx
index 8c783876ae..592c2b4d1b 100644
--- a/packages/views/common/mcp-server-row.tsx
+++ b/packages/views/common/mcp-server-row.tsx
@@ -13,6 +13,7 @@ import {
X,
} from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import {
Tooltip,
@@ -185,31 +186,31 @@ export function McpServerRow({
</p>
) : null}
</div>
- <Button
+ <IconButton
type="submit"
variant="secondary"
size="icon-sm"
className="mt-0.5"
disabled={rename.pending}
- aria-label={labels.renameSave}
+ label={labels.renameSave}
>
{rename.pending ? (
<Loader2 className="animate-spin motion-reduce:animate-none" />
) : (
<Check />
)}
- </Button>
- <Button
+ </IconButton>
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
className="mt-0.5 text-muted-foreground"
disabled={rename.pending}
onClick={rename.onCancel}
- aria-label={labels.renameCancel}
+ label={labels.renameCancel}
>
<X />
- </Button>
+ </IconButton>
</form>
) : (
<span className="truncate text-body font-medium">{name}</span>
diff --git a/packages/views/common/pill-button.tsx b/packages/views/common/pill-button.tsx
index 9a9ae06d12..e1ab582af3 100644
--- a/packages/views/common/pill-button.tsx
+++ b/packages/views/common/pill-button.tsx
@@ -1,6 +1,7 @@
"use client";
import { X as XIcon } from "lucide-react";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { cn } from "@multica/ui/lib/utils";
// Shared pill chrome. `PillButton` puts it on the button itself; the clearable
@@ -102,18 +103,19 @@ export function ClearablePillButton({
{children}
</button>
{clearable && (
- <button
- type="button"
- aria-label={clearLabel}
- title={clearLabel}
- onClick={(e) => {
- e.stopPropagation();
- onClear?.();
- }}
- className="flex shrink-0 items-center py-1 pl-0.5 pr-2 text-muted-foreground hover:text-foreground cursor-pointer"
- >
- <XIcon className="size-3" />
- </button>
+ <TooltipHint label={clearLabel}>
+ <button
+ type="button"
+ aria-label={clearLabel}
+ onClick={(e) => {
+ e.stopPropagation();
+ onClear?.();
+ }}
+ className="flex shrink-0 items-center py-1 pl-0.5 pr-2 text-muted-foreground hover:text-foreground cursor-pointer"
+ >
+ <XIcon className="size-3" />
+ </button>
+ </TooltipHint>
)}
</span>
);
diff --git a/packages/views/common/property-icon.tsx b/packages/views/common/property-icon.tsx
index f9020b42d0..0cddc7b576 100644
--- a/packages/views/common/property-icon.tsx
+++ b/packages/views/common/property-icon.tsx
@@ -44,6 +44,7 @@ import {
Zap,
type LucideIcon,
} from "lucide-react";
+import { DeferredTooltip } from "./deferred-tooltip";
interface PropertyIconOption {
value: string;
@@ -155,20 +156,24 @@ export function PropertyIconPicker({
{PROPERTY_ICON_OPTIONS.map((option) => {
const selected = option.value === value;
return (
- <button
+ <DeferredTooltip
key={option.value}
- type="button"
- aria-label={option.label}
- aria-pressed={selected}
- title={option.label}
- className={cn(
- "flex size-9 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
- selected && "bg-brand/10 text-brand ring-1 ring-inset ring-brand/25",
- )}
- onClick={() => onSelect(option.value)}
- >
- <option.Icon className="size-4" />
- </button>
+ content={option.label}
+ trigger={
+ <button
+ type="button"
+ aria-label={option.label}
+ aria-pressed={selected}
+ className={cn(
+ "flex size-9 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
+ selected && "bg-brand/10 text-brand ring-1 ring-inset ring-brand/25",
+ )}
+ onClick={() => onSelect(option.value)}
+ >
+ <option.Icon className="size-4" />
+ </button>
+ }
+ />
);
})}
</div>
diff --git a/packages/views/common/shortcut-keycaps.tsx b/packages/views/common/shortcut-keycaps.tsx
index b0a979742d..02856a53d6 100644
--- a/packages/views/common/shortcut-keycaps.tsx
+++ b/packages/views/common/shortcut-keycaps.tsx
@@ -17,6 +17,8 @@ import {
import {
formatShortcut,
getShortcutPlatform,
+ useShortcut,
+ type ShortcutActionId,
type ShortcutChord,
type ShortcutPlatform,
} from "@multica/core/shortcuts";
@@ -124,3 +126,12 @@ export function ShortcutKeycaps({
</span>
);
}
+
+/**
+ * Decorative keycaps for a registered action's current binding, for a tooltip
+ * whose text already names the action. Renders nothing when it is unbound.
+ */
+export function ActionShortcutKeycaps({ action }: { action: ShortcutActionId }) {
+ const shortcut = useShortcut(action);
+ return shortcut ? <ShortcutKeycaps shortcut={shortcut} decorative /> : null;
+}
diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx
index 17bc4094e5..22d39e181c 100644
--- a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx
+++ b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx
@@ -848,7 +848,7 @@ describe("AgentTranscriptDialog — work directory handoff", () => {
expect(screen.getByText("Project directory")).toBeInTheDocument();
expect(screen.getByText("project")).toBeInTheDocument();
- await userEvent.click(screen.getByTitle("Copy project directory"));
+ await userEvent.click(screen.getByRole("button", { name: /^Project directory/ }));
expect(copyTextMock).toHaveBeenCalledWith("/Users/dev/project");
});
@@ -867,7 +867,7 @@ describe("AgentTranscriptDialog — work directory handoff", () => {
expect(screen.getByText("Workdir")).toBeInTheDocument();
expect(screen.getByText("workspace/task/worktree")).toBeInTheDocument();
- await userEvent.click(screen.getByTitle("Copy working directory"));
+ await userEvent.click(screen.getByRole("button", { name: /^Workdir/ }));
expect(copyTextMock).toHaveBeenCalledWith("/managed/task/worktree");
});
@@ -885,7 +885,7 @@ describe("AgentTranscriptDialog — work directory handoff", () => {
expect(screen.getByText("Workdir")).toBeInTheDocument();
expect(screen.getByText("workspace/task/worktree")).toBeInTheDocument();
- await userEvent.click(screen.getByTitle("Copy working directory"));
+ await userEvent.click(screen.getByRole("button", { name: /^Workdir/ }));
expect(copyTextMock).toHaveBeenCalledWith("/managed/preserved/worktree");
});
});
@@ -905,7 +905,7 @@ describe("AgentTranscriptDialog — delivered branch", () => {
// Also shown as a produced artifact in the outcome row, hence getAllByText.
expect(screen.getAllByText("agent/j/abc12345").length).toBeGreaterThan(0);
- await userEvent.click(screen.getByTitle("Copy branch name"));
+ await userEvent.click(screen.getByRole("button", { name: /^Branch/ }));
expect(copyTextMock).toHaveBeenCalledWith("agent/j/abc12345");
});
@@ -914,7 +914,7 @@ describe("AgentTranscriptDialog — delivered branch", () => {
await userEvent.click(screen.getByRole("button", { name: "Run details" }));
- expect(screen.queryByTitle("Copy branch name")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /^Branch/ })).not.toBeInTheDocument();
});
});
diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.tsx
index ac6b1447df..9204b98a65 100644
--- a/packages/views/common/task-transcript/agent-transcript-dialog.tsx
+++ b/packages/views/common/task-transcript/agent-transcript-dialog.tsx
@@ -31,6 +31,7 @@ import {
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Dialog, DialogContent, DialogTitle } from "@multica/ui/components/ui/dialog";
import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";
import {
@@ -105,6 +106,7 @@ import {
import { formatBytes } from "../format-bytes";
import "../../editor/styles/code.css";
import "./task-transcript.css";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
// The run surface, read in four layers: what happened (header), what it
// produced (outcome), where the time went (timeline), and the evidence (steps).
@@ -243,22 +245,23 @@ function RunDetailRow({
const valueClass = cn("min-w-0 select-text break-all text-foreground", mono && "font-mono");
if (onCopy) {
return (
- <button
- type="button"
- onClick={onCopy}
- title={copyTitle}
- className="group -mx-1 grid w-[calc(100%+0.5rem)] grid-cols-[4.5rem_minmax(0,1fr)] items-start gap-3 rounded-xs px-1 py-0.5 text-left transition-colors hover:bg-accent/60"
- >
- <span className="text-muted-foreground">{label}</span>
- <span className="flex min-w-0 items-start gap-1.5">
- <span className={cn(valueClass, "flex-1")}>{value}</span>
- {copied ? (
- <Check className="mt-0.5 h-3 w-3 shrink-0 text-success" />
- ) : (
- <Copy className="mt-0.5 h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-100" />
- )}
- </span>
- </button>
+ <TooltipHint label={copyTitle}>
+ <button
+ type="button"
+ onClick={onCopy}
+ className="group -mx-1 grid w-[calc(100%+0.5rem)] grid-cols-[4.5rem_minmax(0,1fr)] items-start gap-3 rounded-xs px-1 py-0.5 text-left transition-colors hover:bg-accent/60"
+ >
+ <span className="text-muted-foreground">{label}</span>
+ <span className="flex min-w-0 items-start gap-1.5">
+ <span className={cn(valueClass, "flex-1")}>{value}</span>
+ {copied ? (
+ <Check className="mt-0.5 h-3 w-3 shrink-0 text-success" />
+ ) : (
+ <Copy className="mt-0.5 h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-100" />
+ )}
+ </span>
+ </button>
+ </TooltipHint>
);
}
return (
@@ -940,11 +943,11 @@ export function AgentTranscriptDialog({
<Popover>
<PopoverTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.transcript.run_info)}
- title={t(($) => $.transcript.run_info)}
+ label={t(($) => $.transcript.run_info)}
+ tooltipSide="bottom"
className="text-muted-foreground"
/>
}
@@ -1072,15 +1075,16 @@ export function AgentTranscriptDialog({
</PopoverContent>
</Popover>
)}
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
onClick={() => onOpenChange(false)}
- aria-label={t(($) => $.transcript.close)}
+ label={t(($) => $.transcript.close)}
+ tooltipSide="bottom"
className="text-muted-foreground"
>
<X className="h-4 w-4" />
- </Button>
+ </IconButton>
</div>
</div>
</div>
@@ -1181,10 +1185,10 @@ export function AgentTranscriptDialog({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.transcript.more_actions)}
+ label={t(($) => $.transcript.more_actions)}
className="text-muted-foreground"
/>
}
@@ -1756,25 +1760,26 @@ function StepInspector({
</>
)}
</span>
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
onClick={handleCopy}
- aria-label={t(($) => $.transcript.copy_step)}
- title={t(($) => $.transcript.copy_step)}
+ label={t(($) => $.transcript.copy_step)}
+ tooltipSide="bottom"
className="shrink-0 text-muted-foreground"
>
{copied ? <Check className="h-3.5 w-3.5" /> : <Copy className="h-3.5 w-3.5" />}
- </Button>
- <Button
+ </IconButton>
+ <IconButton
variant="ghost"
size="icon-sm"
onClick={onClose}
- aria-label={t(($) => $.transcript.close_step)}
+ label={t(($) => $.transcript.close_step)}
+ tooltipSide="bottom"
className="shrink-0 text-muted-foreground"
>
<X className="h-3.5 w-3.5" />
- </Button>
+ </IconButton>
</div>
<div className="min-h-0 flex-1 overflow-y-auto">
{call ? (
diff --git a/packages/views/common/task-transcript/run-timeline.tsx b/packages/views/common/task-transcript/run-timeline.tsx
index 86c667050e..dca9aa77fa 100644
--- a/packages/views/common/task-transcript/run-timeline.tsx
+++ b/packages/views/common/task-transcript/run-timeline.tsx
@@ -2,6 +2,7 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Minus, Plus } from "lucide-react";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { cn } from "@multica/ui/lib/utils";
import {
laneSegmentPosition,
@@ -10,6 +11,7 @@ import {
type TraceLanes,
type ToolKindTotals,
} from "./build-steps";
+import { DeferredTooltip } from "../deferred-tooltip";
import { useT } from "../../i18n";
/**
@@ -90,17 +92,21 @@ function LaneTrack({
return (
<div className="relative h-[15px] rounded-sm bg-muted/55">
{segments.map((segment) => (
- <button
+ <DeferredTooltip
key={`${segment.kind}:${segment.startMs}`}
- type="button"
- aria-label={`${label} ${formatLaneTotal(segment.durationMs)}`}
- title={`${label} · ${formatLaneTotal(segment.durationMs)}`}
- onClick={() => onSeek(segment.startMs)}
- className={cn(
- "absolute inset-y-0 rounded-[3px] transition-opacity hover:opacity-80",
- SEGMENT_TONE[segment.kind],
- )}
- style={laneSegmentPosition(segment, totalMs)}
+ content={`${label} · ${formatLaneTotal(segment.durationMs)}`}
+ trigger={
+ <button
+ type="button"
+ aria-label={`${label} ${formatLaneTotal(segment.durationMs)}`}
+ onClick={() => onSeek(segment.startMs)}
+ className={cn(
+ "absolute inset-y-0 rounded-[3px] transition-opacity hover:opacity-80",
+ SEGMENT_TONE[segment.kind],
+ )}
+ style={laneSegmentPosition(segment, totalMs)}
+ />
+ }
/>
))}
</div>
@@ -261,27 +267,31 @@ export function RunTimeline({
zoom > 1 ? "opacity-100" : "opacity-0 focus-within:opacity-100 group-hover/timeline:opacity-100",
)}
>
- <button
- type="button"
- disabled={!canZoomOut}
- onClick={() => setZoomAround(ZOOM_STEPS[zoomIndex - 1] ?? 1)}
- aria-label={t(($) => $.transcript.timeline_zoom_out)}
- className="flex h-5 w-5 items-center justify-center rounded-xs text-muted-foreground transition-colors hover:bg-accent disabled:opacity-40"
- >
- <Minus className="h-3 w-3" />
- </button>
+ <TooltipHint label={t(($) => $.transcript.timeline_zoom_out)}>
+ <button
+ type="button"
+ disabled={!canZoomOut}
+ onClick={() => setZoomAround(ZOOM_STEPS[zoomIndex - 1] ?? 1)}
+ aria-label={t(($) => $.transcript.timeline_zoom_out)}
+ className="flex h-5 w-5 items-center justify-center rounded-xs text-muted-foreground transition-colors hover:bg-accent disabled:opacity-40"
+ >
+ <Minus className="h-3 w-3" />
+ </button>
+ </TooltipHint>
<span className="min-w-[2rem] text-center text-micro tabular-nums text-muted-foreground">
{zoom}×
</span>
- <button
- type="button"
- disabled={!canZoomIn}
- onClick={() => setZoomAround(ZOOM_STEPS[zoomIndex + 1] ?? zoom)}
- aria-label={t(($) => $.transcript.timeline_zoom_in)}
- className="flex h-5 w-5 items-center justify-center rounded-xs text-muted-foreground transition-colors hover:bg-accent disabled:opacity-40"
- >
- <Plus className="h-3 w-3" />
- </button>
+ <TooltipHint label={t(($) => $.transcript.timeline_zoom_in)}>
+ <button
+ type="button"
+ disabled={!canZoomIn}
+ onClick={() => setZoomAround(ZOOM_STEPS[zoomIndex + 1] ?? zoom)}
+ aria-label={t(($) => $.transcript.timeline_zoom_in)}
+ className="flex h-5 w-5 items-center justify-center rounded-xs text-muted-foreground transition-colors hover:bg-accent disabled:opacity-40"
+ >
+ <Plus className="h-3 w-3" />
+ </button>
+ </TooltipHint>
</div>
</div>
);
diff --git a/packages/views/dashboard/components/dashboard-page.tsx b/packages/views/dashboard/components/dashboard-page.tsx
index 219dd40b8a..bf88894c66 100644
--- a/packages/views/dashboard/components/dashboard-page.tsx
+++ b/packages/views/dashboard/components/dashboard-page.tsx
@@ -3,7 +3,7 @@
import { useMemo, useState } from "react";
import { BarChart3, RefreshCw } from "lucide-react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@multica/ui/components/ui/tabs";
import {
@@ -480,15 +480,16 @@ export function DashboardPage() {
: tzLabel}
</span>
) : null}
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.header.refresh)}
+ label={t(($) => $.header.refresh)}
+ tooltipSide="bottom"
onClick={handleRefresh}
disabled={isRefreshing}
>
<RefreshCw className={isRefreshing ? "animate-spin" : undefined} />
- </Button>
+ </IconButton>
</div>
}
/>
diff --git a/packages/views/editor/attachment-card.test.tsx b/packages/views/editor/attachment-card.test.tsx
index c659e49fd7..662b1a5b3c 100644
--- a/packages/views/editor/attachment-card.test.tsx
+++ b/packages/views/editor/attachment-card.test.tsx
@@ -50,9 +50,9 @@ describe("AttachmentCard — chrome row", () => {
onDownload={() => {}}
/>,
);
- expect(screen.queryByTitle("Preview")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Preview" })).toBeNull();
// Download stays available — the underlying URL is still reachable.
- expect(screen.getByTitle("Download")).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Download" })).toBeTruthy();
});
it("shows the Eye button for an html source when an attachmentId is available", () => {
@@ -66,7 +66,7 @@ describe("AttachmentCard — chrome row", () => {
onDownload={() => {}}
/>,
);
- expect(screen.getByTitle("Preview")).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Preview" })).toBeTruthy();
});
it("shows the Eye button for a URL-only pdf source (modal renders pdfs directly from URL)", () => {
@@ -82,7 +82,7 @@ describe("AttachmentCard — chrome row", () => {
onDownload={() => {}}
/>,
);
- expect(screen.getByTitle("Preview")).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Preview" })).toBeTruthy();
});
});
@@ -99,7 +99,7 @@ describe("AttachmentCard — Eye / Download buttons", () => {
onDownload={() => {}}
/>,
);
- fireEvent.mouseDown(screen.getByTitle("Preview"));
+ fireEvent.mouseDown(screen.getByRole("button", { name: "Preview" }));
expect(onPreview).toHaveBeenCalled();
});
@@ -115,7 +115,7 @@ describe("AttachmentCard — Eye / Download buttons", () => {
onDownload={onDownload}
/>,
);
- fireEvent.mouseDown(screen.getByTitle("Download"));
+ fireEvent.mouseDown(screen.getByRole("button", { name: "Download" }));
expect(onDownload).toHaveBeenCalled();
});
@@ -131,8 +131,8 @@ describe("AttachmentCard — Eye / Download buttons", () => {
onDownload={() => {}}
/>,
);
- expect(screen.queryByTitle("Preview")).toBeNull();
- expect(screen.queryByTitle("Download")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Preview" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Download" })).toBeNull();
// The mock `t()` returns the i18n template as-is; the production t-fn
// interpolates {{filename}} → "report.html". Asserting the template
// proves the uploading branch was selected without depending on the
diff --git a/packages/views/editor/attachment-card.tsx b/packages/views/editor/attachment-card.tsx
index a721256943..8b75615e0e 100644
--- a/packages/views/editor/attachment-card.tsx
+++ b/packages/views/editor/attachment-card.tsx
@@ -14,6 +14,7 @@
import type { ReactNode } from "react";
import { Download, Eye, FileText, Loader2, Trash2 } from "lucide-react";
import { useT } from "../i18n";
+import { DeferredTooltip } from "../common/deferred-tooltip";
import { formatBytes } from "../common/format-bytes";
import { fileIcon } from "./utils/file-icon";
import { canOpenPreview, fileTypeLabel, getPreviewKind } from "./utils/preview";
@@ -58,49 +59,61 @@ function AttachmentCardChrome({
</p>
</div>
{!uploading && canPreview && (
- <button
- type="button"
- className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
- title={t(($) => $.attachment.preview)}
- aria-label={t(($) => $.attachment.preview)}
- onMouseDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- onPreview();
- }}
- >
- <Eye className="size-3.5" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.attachment.preview)}
+ trigger={
+ <button
+ type="button"
+ className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
+ aria-label={t(($) => $.attachment.preview)}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ onPreview();
+ }}
+ >
+ <Eye className="size-3.5" />
+ </button>
+ }
+ />
)}
{!uploading && canDownload && (
- <button
- type="button"
- className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
- title={t(($) => $.image.download)}
- aria-label={t(($) => $.image.download)}
- onMouseDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- onDownload();
- }}
- >
- <Download className="size-3.5" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.image.download)}
+ trigger={
+ <button
+ type="button"
+ className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
+ aria-label={t(($) => $.image.download)}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ onDownload();
+ }}
+ >
+ <Download className="size-3.5" />
+ </button>
+ }
+ />
)}
{!uploading && canDelete && onDelete && (
- <button
- type="button"
- className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive"
- title={t(($) => $.attachment.remove)}
- aria-label={t(($) => $.attachment.remove)}
- onMouseDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- onDelete();
- }}
- >
- <Trash2 className="size-3.5" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.attachment.remove)}
+ trigger={
+ <button
+ type="button"
+ className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive"
+ aria-label={t(($) => $.attachment.remove)}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ onDelete();
+ }}
+ >
+ <Trash2 className="size-3.5" />
+ </button>
+ }
+ />
)}
</div>
);
@@ -236,26 +249,34 @@ export function AttachmentFileCard({
{!uploading && (canDownload || onDelete) && (
<span className="relative flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/file-card:opacity-100 group-focus-within/file-card:opacity-100 [@media(hover:none)]:opacity-100">
{canDownload && (
- <button
- type="button"
- className="rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
- title={t(($) => $.image.download)}
- aria-label={t(($) => $.image.download)}
- onClick={onDownload}
- >
- <Download className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.image.download)}
+ trigger={
+ <button
+ type="button"
+ className="rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
+ aria-label={t(($) => $.image.download)}
+ onClick={onDownload}
+ >
+ <Download className="size-4" />
+ </button>
+ }
+ />
)}
{onDelete && (
- <button
- type="button"
- className="rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive"
- title={t(($) => $.attachment.remove)}
- aria-label={t(($) => $.attachment.remove)}
- onClick={onDelete}
- >
- <Trash2 className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.attachment.remove)}
+ trigger={
+ <button
+ type="button"
+ className="rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive"
+ aria-label={t(($) => $.attachment.remove)}
+ onClick={onDelete}
+ >
+ <Trash2 className="size-4" />
+ </button>
+ }
+ />
)}
</span>
)}
diff --git a/packages/views/editor/attachment-preview-modal.test.tsx b/packages/views/editor/attachment-preview-modal.test.tsx
index 3d097ee149..2e8cf0541b 100644
--- a/packages/views/editor/attachment-preview-modal.test.tsx
+++ b/packages/views/editor/attachment-preview-modal.test.tsx
@@ -625,7 +625,7 @@ describe("AttachmentPreviewModal — controls", () => {
render(<AttachmentPreviewModal source={{ kind: "full", attachment: att }} open onClose={() => {}} />);
// Two Download CTAs may exist (header + unsupported fallback). The header
// button is always present, look it up by aria-label/title.
- const buttons = screen.getAllByTitle("Download");
+ const buttons = screen.getAllByRole("button", { name: "Download" });
expect(buttons.length).toBeGreaterThan(0);
fireEvent.click(buttons[0]!);
expect(downloadMock).toHaveBeenCalledWith("att-1");
@@ -650,7 +650,7 @@ describe("AttachmentPreviewModal — controls", () => {
render(<ClosablePreview attachment={att} />);
expect(setImmersiveMode).toHaveBeenLastCalledWith(true);
- fireEvent.click(screen.getByTitle("Close"));
+ fireEvent.click(screen.getByRole("button", { name: "Close" }));
await waitFor(() => {
expect(setImmersiveMode).toHaveBeenLastCalledWith(false);
});
@@ -675,7 +675,7 @@ describe("AttachmentPreviewModal — controls", () => {
});
render(<ClosablePreview attachment={att} />);
- fireEvent.click(screen.getByTitle("Close"));
+ fireEvent.click(screen.getByRole("button", { name: "Close" }));
expect(screen.getByRole("dialog")).toBeInTheDocument();
await waitFor(() => {
@@ -793,7 +793,7 @@ describe("AttachmentPreviewModal — URL-only source", () => {
onClose={() => {}}
/>,
);
- const button = screen.getAllByTitle("Download")[0]!;
+ const button = screen.getAllByRole("button", { name: "Download" })[0]!;
fireEvent.click(button);
expect(openExternalMock).toHaveBeenCalledWith(url);
expect(downloadMock).not.toHaveBeenCalled();
@@ -817,7 +817,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={() => {}}
/>,
);
- expect(screen.getByTitle("Open in new tab")).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Open in new tab" })).toBeTruthy();
});
it("invokes navigation.openInNewTab with the preview path and closes the modal (desktop)", async () => {
@@ -837,7 +837,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={onClose}
/>,
);
- fireEvent.click(screen.getByTitle("Open in new tab"));
+ fireEvent.click(screen.getByRole("button", { name: "Open in new tab" }));
expect(openInNewTabMock).toHaveBeenCalledWith(
"/acme/attachments/att-1/preview?name=report.html",
"report.html",
@@ -865,7 +865,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
const input = await screen.findByLabelText("Address");
fireEvent.change(input, { target: { value: "?s=ia#top" } });
fireEvent.submit(input.closest("form")!);
- fireEvent.click(screen.getByTitle("Open in new tab"));
+ fireEvent.click(screen.getByRole("button", { name: "Open in new tab" }));
expect(openInNewTabMock).toHaveBeenCalledWith(
"/acme/attachments/att-1/preview?name=report.html&loc=%3Fs%3Dia%23top",
"report.html",
@@ -894,7 +894,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={onClose}
/>,
);
- fireEvent.click(screen.getByTitle("Open in new tab"));
+ fireEvent.click(screen.getByRole("button", { name: "Open in new tab" }));
expect(openInNewTabMock).not.toHaveBeenCalled();
expect(windowOpenSpy).toHaveBeenCalledWith(
"https://app.example/acme/attachments/att-1/preview?name=report.html",
@@ -921,7 +921,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={() => {}}
/>,
);
- fireEvent.click(screen.getByTitle("Open in new tab"));
+ fireEvent.click(screen.getByRole("button", { name: "Open in new tab" }));
expect(openInNewTabMock).toHaveBeenCalledWith(
`/acme/attachments/att-1/preview?name=${filename}`,
filename,
@@ -941,7 +941,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={() => {}}
/>,
);
- expect(screen.queryByTitle("Open in new tab")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Open in new tab" })).toBeNull();
});
it("does not render the new-tab button for a URL-only source — the page loads by id", () => {
@@ -952,7 +952,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={() => {}}
/>,
);
- expect(screen.queryByTitle("Open in new tab")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Open in new tab" })).toBeNull();
});
it("does not render the new-tab button when there is no workspace slug", async () => {
@@ -972,7 +972,7 @@ describe("AttachmentPreviewModal — open-in-new-tab", () => {
onClose={() => {}}
/>,
);
- expect(screen.queryByTitle("Open in new tab")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Open in new tab" })).toBeNull();
});
});
@@ -1248,7 +1248,7 @@ describe("AttachmentPreviewModal — image zoom", () => {
fireEvent.click(screen.getByRole("button", { name: "Actual size" }));
expect(currentScale()).toBe(1);
- fireEvent.click(screen.getByTitle("Close"));
+ fireEvent.click(screen.getByRole("button", { name: "Close" }));
await waitFor(() => {
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
});
@@ -1327,7 +1327,7 @@ describe("AttachmentPreviewModal — text views", () => {
openText("main.go", "package main\n\nfunc main() {}\n");
await waitFor(() => expect(document.querySelectorAll(".code-line")).toHaveLength(3));
expect(document.querySelector("pre.code-lines")).not.toHaveClass("code-lines-wrap");
- expect(screen.getByTitle("Wrap lines")).toHaveAttribute("aria-pressed", "false");
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toHaveAttribute("aria-pressed", "false");
});
it("wraps a log by default and lets the reader turn it off", async () => {
@@ -1336,9 +1336,9 @@ describe("AttachmentPreviewModal — text views", () => {
const pre = document.querySelector("pre.code-lines");
expect(pre).toHaveClass("code-lines-wrap");
- fireEvent.click(screen.getByTitle("Wrap lines"));
+ fireEvent.click(screen.getByRole("button", { name: "Wrap lines" }));
expect(document.querySelector("pre.code-lines")).not.toHaveClass("code-lines-wrap");
- expect(screen.getByTitle("Wrap lines")).toHaveAttribute("aria-pressed", "false");
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toHaveAttribute("aria-pressed", "false");
});
it("keeps the reader's wrap choice when the viewer moves to another file", async () => {
@@ -1353,7 +1353,7 @@ describe("AttachmentPreviewModal — text views", () => {
);
const { rerender } = rtlRender(viewer(first));
await waitFor(() => expect(document.querySelector("pre.code-lines")).toBeTruthy());
- fireEvent.click(screen.getByTitle("Wrap lines"));
+ fireEvent.click(screen.getByRole("button", { name: "Wrap lines" }));
rerender(viewer(second));
await waitFor(() => expect(document.querySelector("pre.code-lines")).toBeTruthy());
@@ -1393,14 +1393,14 @@ describe("AttachmentPreviewModal — html viewports", () => {
it("shows the source with line numbers, and holds the viewport while it does", async () => {
openHtml();
await screen.findByTitle("prototype.html");
- expect(screen.getByTitle("Wrap lines")).toBeDisabled();
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toBeDisabled();
- fireEvent.click(screen.getByTitle("View source"));
- expect(screen.getByTitle("View source")).toHaveAttribute("aria-pressed", "true");
+ fireEvent.click(screen.getByRole("button", { name: "View source" }));
+ expect(screen.getByRole("button", { name: "View source" })).toHaveAttribute("aria-pressed", "true");
expect(screen.queryByTitle("prototype.html")).toBeNull();
expect(document.querySelector(".code-line")?.textContent).toBe("<h1>Prototype</h1>");
expect(screen.getByRole("button", { name: "Phone" })).toBeDisabled();
- expect(screen.getByTitle("Wrap lines")).toBeEnabled();
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toBeEnabled();
});
});
@@ -1418,14 +1418,14 @@ describe("AttachmentPreviewModal — structured data", () => {
await screen.findByText("name");
expect(screen.getByText('"web"')).toBeTruthy();
expect(screen.getByRole("button", { name: "Tree" })).toHaveAttribute("aria-pressed", "true");
- expect(screen.getByTitle("Wrap lines")).toBeDisabled();
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toBeDisabled();
fireEvent.click(screen.getByRole("button", { name: "Raw" }));
expect(screen.queryByText("name")).toBeNull();
expect(document.querySelector(".code-line")?.textContent).toBe(
'{"name":"web","ports":[80,443]}',
);
- expect(screen.getByTitle("Wrap lines")).toBeEnabled();
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toBeEnabled();
});
it("parses YAML into the same tree", async () => {
@@ -1439,7 +1439,7 @@ describe("AttachmentPreviewModal — structured data", () => {
expect(document.querySelector(".code-line")?.textContent).toBe('{"name": ');
expect(screen.getByRole("button", { name: "Tree" })).toBeDisabled();
expect(screen.getByRole("button", { name: "Raw" })).toHaveAttribute("aria-pressed", "true");
- expect(screen.getByTitle("Wrap lines")).toBeEnabled();
+ expect(screen.getByRole("button", { name: "Wrap lines" })).toBeEnabled();
});
});
diff --git a/packages/views/editor/attachment-preview-modal.tsx b/packages/views/editor/attachment-preview-modal.tsx
index 4578b6419f..7b7792ffd2 100644
--- a/packages/views/editor/attachment-preview-modal.tsx
+++ b/packages/views/editor/attachment-preview-modal.tsx
@@ -56,7 +56,9 @@ import {
} from "lucide-react";
import type { Attachment } from "@multica/core/types";
import { paths, useWorkspaceSlug } from "@multica/core/paths";
+import { createShortcutChord } from "@multica/core/shortcuts";
import { cn } from "@multica/ui/lib/utils";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { copyImage } from "@multica/ui/lib/clipboard";
import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";
import {
@@ -81,6 +83,7 @@ import {
} from "./utils/preview";
import { parseStructured } from "./utils/parse-structured";
import { formatBytes } from "../common/format-bytes";
+import { ShortcutKeycaps } from "../common/shortcut-keycaps";
import { useDownloadAttachment } from "./use-download-attachment";
import { useAttachmentHtmlText } from "./hooks/use-attachment-html-text";
import { useResignedInlineMedia } from "./hooks/use-inline-media-url";
@@ -1099,21 +1102,30 @@ function ChromeButton({
children: ReactNode;
}) {
return (
- <button
- type="button"
- className={cn(
- "flex size-8 items-center justify-center rounded-md transition-colors enabled:hover:bg-secondary enabled:hover:text-foreground disabled:opacity-40",
- pressed ? "bg-secondary text-foreground" : "text-muted-foreground",
- )}
- title={shortcut ? `${label} (${shortcut})` : label}
- aria-label={label}
- aria-keyshortcuts={shortcut}
- aria-pressed={pressed}
- disabled={disabled}
- onClick={onClick}
+ <TooltipHint
+ label={label}
+ shortcut={
+ shortcut ? (
+ <ShortcutKeycaps shortcut={createShortcutChord(shortcut)} decorative className="ml-1.5" />
+ ) : undefined
+ }
+ side="bottom"
>
- {children}
- </button>
+ <button
+ type="button"
+ className={cn(
+ "flex size-8 items-center justify-center rounded-md transition-colors enabled:hover:bg-secondary enabled:hover:text-foreground disabled:opacity-40",
+ pressed ? "bg-secondary text-foreground" : "text-muted-foreground",
+ )}
+ aria-label={label}
+ aria-keyshortcuts={shortcut}
+ aria-pressed={pressed}
+ disabled={disabled}
+ onClick={onClick}
+ >
+ {children}
+ </button>
+ </TooltipHint>
);
}
@@ -1139,24 +1151,24 @@ function ChromeSegmented<T extends string>({
const pressed = option.value === value;
const Icon = option.icon;
return (
- <button
- key={option.value}
- type="button"
- className={cn(
- "flex h-8 min-w-8 items-center justify-center gap-1.5 rounded-md px-2 text-label transition-colors enabled:hover:bg-secondary enabled:hover:text-foreground disabled:opacity-40",
- pressed ? "bg-secondary text-foreground" : "text-muted-foreground",
- )}
- title={option.label}
- aria-label={option.label}
- aria-pressed={pressed}
- disabled={disabled}
- onClick={() => onChange(option.value)}
- >
- <Icon className="size-4 shrink-0" />
- <span className="hidden @7xl:inline" aria-hidden>
- {option.label}
- </span>
- </button>
+ <TooltipHint key={option.value} label={option.label} side="bottom">
+ <button
+ type="button"
+ className={cn(
+ "flex h-8 min-w-8 items-center justify-center gap-1.5 rounded-md px-2 text-label transition-colors enabled:hover:bg-secondary enabled:hover:text-foreground disabled:opacity-40",
+ pressed ? "bg-secondary text-foreground" : "text-muted-foreground",
+ )}
+ aria-label={option.label}
+ aria-pressed={pressed}
+ disabled={disabled}
+ onClick={() => onChange(option.value)}
+ >
+ <Icon className="size-4 shrink-0" />
+ <span className="hidden @7xl:inline" aria-hidden>
+ {option.label}
+ </span>
+ </button>
+ </TooltipHint>
);
})}
</div>
@@ -1183,19 +1195,20 @@ function SequenceButton({
}) {
const Icon = side === "prev" ? ChevronLeft : ChevronRight;
return (
- <button
- type="button"
- className={cn(
- "dark absolute top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-secondary/80 text-foreground transition-colors enabled:hover:bg-secondary disabled:opacity-30",
- side === "prev" ? "left-3" : "right-3",
- )}
- title={label}
- aria-label={label}
- disabled={!onClick}
- onClick={onClick}
- >
- <Icon className="size-5" />
- </button>
+ <TooltipHint label={label}>
+ <button
+ type="button"
+ className={cn(
+ "dark absolute top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-secondary/80 text-foreground transition-colors enabled:hover:bg-secondary disabled:opacity-30",
+ side === "prev" ? "left-3" : "right-3",
+ )}
+ aria-label={label}
+ disabled={!onClick}
+ onClick={onClick}
+ >
+ <Icon className="size-5" />
+ </button>
+ </TooltipHint>
);
}
diff --git a/packages/views/editor/attachment.test.tsx b/packages/views/editor/attachment.test.tsx
index d1e4dfd1c6..7cb24cc1ee 100644
--- a/packages/views/editor/attachment.test.tsx
+++ b/packages/views/editor/attachment.test.tsx
@@ -232,11 +232,11 @@ describe("Attachment — image dispatch", () => {
// attachment.tsx for the rationale (MUL-3130 review follow-up).
expect(img?.getAttribute("src")).toBe(att.download_url);
expect(img?.getAttribute("alt")).toBe("shot.png");
- expect(screen.getByTitle("View")).toBeTruthy();
- expect(screen.getByTitle("Download")).toBeTruthy();
- expect(screen.getByTitle("Copy link")).toBeTruthy();
+ expect(screen.getByRole("button", { name: "View" })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Download" })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Copy link" })).toBeTruthy();
// Trash only shows in editable mode.
- expect(screen.queryByTitle("Delete")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Delete" })).toBeNull();
});
it("editable image shows Trash button and wires onDelete", () => {
@@ -249,7 +249,7 @@ describe("Attachment — image dispatch", () => {
onDelete={onDelete}
/>,
);
- const trash = screen.getByTitle("Delete");
+ const trash = screen.getByRole("button", { name: "Delete" });
fireEvent.click(trash);
expect(onDelete).toHaveBeenCalled();
});
@@ -276,7 +276,7 @@ describe("Attachment — image dispatch", () => {
// (MUL-3130 review). The raw stored url is the fallback for
// unresolved markdown only.
expect(img?.getAttribute("src")).toBe(att.download_url);
- fireEvent.click(screen.getByTitle("Download"));
+ fireEvent.click(screen.getByRole("button", { name: "Download" }));
expect(downloadMock).toHaveBeenCalledWith("att-1");
});
@@ -339,7 +339,7 @@ describe("Attachment — image dispatch", () => {
expect(document.querySelector("img")?.getAttribute("src")).toBe(mediaUrl);
- fireEvent.click(screen.getByTitle("View"));
+ fireEvent.click(screen.getByRole("button", { name: "View" }));
const imageSrcs = [...document.querySelectorAll("img")].map((img) =>
img.getAttribute("src"),
@@ -371,7 +371,7 @@ describe("Attachment — image dispatch", () => {
/>,
);
- fireEvent.click(screen.getByTitle("View"));
+ fireEvent.click(screen.getByRole("button", { name: "View" }));
const imageSrcs = [...document.querySelectorAll("img")].map((img) =>
img.getAttribute("src"),
@@ -609,7 +609,7 @@ describe("Attachment — image dispatch", () => {
await waitFor(() => {
expect(document.querySelector("img")?.getAttribute("src")).toBe(OBJECT_URL);
});
- fireEvent.click(screen.getByTitle("Copy link"));
+ fireEvent.click(screen.getByRole("button", { name: "Copy link" }));
await waitFor(() => expect(writeText).toHaveBeenCalledWith(markdownUrl));
});
@@ -713,7 +713,7 @@ describe("Attachment — image dispatch", () => {
}}
/>,
);
- fireEvent.click(screen.getByTitle("View"));
+ fireEvent.click(screen.getByRole("button", { name: "View" }));
expect(screen.queryByText("This file type can't be previewed.")).toBeNull();
expect(screen.getByRole("dialog").querySelector("img")).toBeTruthy();
});
@@ -730,7 +730,7 @@ describe("Attachment — image dispatch", () => {
);
const img = document.querySelector("img");
expect(img?.getAttribute("src")).toBe("https://external.example/foo.png");
- fireEvent.click(screen.getByTitle("Download"));
+ fireEvent.click(screen.getByRole("button", { name: "Download" }));
expect(openByUrlMock).toHaveBeenCalledWith("https://external.example/foo.png");
expect(downloadMock).not.toHaveBeenCalled();
});
@@ -746,8 +746,8 @@ describe("Attachment — image dispatch", () => {
}}
/>,
);
- expect(screen.queryByTitle("View")).toBeNull();
- expect(screen.queryByTitle("Download")).toBeNull();
+ expect(screen.queryByRole("button", { name: "View" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Download" })).toBeNull();
});
it("stable /api/attachments/<id>/download download_url falls through to the durable record.markdown_url for native <img> loadability (MUL-3192)", () => {
@@ -799,8 +799,8 @@ describe("Attachment — html dispatch", () => {
});
renderWithQuery(<Attachment attachment={{ kind: "record", attachment: att }} />);
expect(screen.getByText("report.html")).toBeTruthy();
- expect(screen.getByTitle("Preview")).toBeTruthy();
- expect(screen.getByTitle("Download")).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Preview" })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Download" })).toBeTruthy();
expect(document.querySelector("iframe")).toBeNull();
expect(getAttachmentTextContentMock).not.toHaveBeenCalled();
});
@@ -856,7 +856,7 @@ describe("Attachment — file-card dispatch", () => {
);
expect(screen.getByText("manual.pdf")).toBeTruthy();
- fireEvent.mouseDown(screen.getByTitle("Download"));
+ fireEvent.mouseDown(screen.getByRole("button", { name: "Download" }));
expect(downloadMock).toHaveBeenCalledWith(id);
});
@@ -873,8 +873,8 @@ describe("Attachment — file-card dispatch", () => {
);
expect(screen.getByText("Uploading {{filename}}")).toBeTruthy();
// Preview/Download chrome is hidden while uploading.
- expect(screen.queryByTitle("Preview")).toBeNull();
- expect(screen.queryByTitle("Download")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Preview" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Download" })).toBeNull();
});
});
diff --git a/packages/views/editor/attachment.tsx b/packages/views/editor/attachment.tsx
index d7dba81103..127efe0e42 100644
--- a/packages/views/editor/attachment.tsx
+++ b/packages/views/editor/attachment.tsx
@@ -41,6 +41,7 @@ import { api } from "@multica/core/api";
import { useConfigStore } from "@multica/core/config";
import type { Attachment as AttachmentRecord } from "@multica/core/types";
import { useT } from "../i18n";
+import { DeferredTooltip } from "../common/deferred-tooltip";
import { useAttachmentDownloadResolver } from "./attachment-download-context";
import { useAttachmentPreview } from "./attachment-preview-modal";
import { usePreviewSequence } from "./preview-sequence-context";
@@ -503,19 +504,39 @@ function ImageAttachmentView({
onMouseDown={(e) => e.stopPropagation()}
onClick={(e) => e.stopPropagation()}
>
- <button type="button" onClick={onView} title={t(($) => $.image.view)}>
- <Maximize2 className="size-3.5" />
- </button>
- <button type="button" onClick={onDownload} title={t(($) => $.image.download)}>
- <Download className="size-3.5" />
- </button>
- <button type="button" onClick={handleCopyLink} title={t(($) => $.image.copy_link)}>
- <LinkIcon className="size-3.5" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.image.view)}
+ trigger={
+ <button type="button" onClick={onView} aria-label={t(($) => $.image.view)}>
+ <Maximize2 className="size-3.5" />
+ </button>
+ }
+ />
+ <DeferredTooltip
+ content={t(($) => $.image.download)}
+ trigger={
+ <button type="button" onClick={onDownload} aria-label={t(($) => $.image.download)}>
+ <Download className="size-3.5" />
+ </button>
+ }
+ />
+ <DeferredTooltip
+ content={t(($) => $.image.copy_link)}
+ trigger={
+ <button type="button" onClick={handleCopyLink} aria-label={t(($) => $.image.copy_link)}>
+ <LinkIcon className="size-3.5" />
+ </button>
+ }
+ />
{editable && onDelete && (
- <button type="button" onClick={onDelete} title={t(($) => $.image.delete)}>
- <Trash2 className="size-3.5" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.image.delete)}
+ trigger={
+ <button type="button" onClick={onDelete} aria-label={t(($) => $.image.delete)}>
+ <Trash2 className="size-3.5" />
+ </button>
+ }
+ />
)}
</span>
)}
diff --git a/packages/views/editor/bubble-menu.tsx b/packages/views/editor/bubble-menu.tsx
index 8375a5ecab..32a635ee0f 100644
--- a/packages/views/editor/bubble-menu.tsx
+++ b/packages/views/editor/bubble-menu.tsx
@@ -51,7 +51,7 @@ import {
PopoverContent,
} from "@multica/ui/components/ui/popover";
import { Input } from "@multica/ui/components/ui/input";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
Bold,
Italic,
@@ -216,35 +216,35 @@ function LinkEditBar({
if (e.key === "Escape") { e.preventDefault(); onClose(); editor.commands.focus(); }
}}
/>
- <Button
+ <IconButton
size="icon-xs"
variant="ghost"
- aria-label={t(($) => $.bubble_menu.link_edit.apply)}
+ label={t(($) => $.bubble_menu.link_edit.apply)}
onClick={apply}
onMouseDown={(e) => e.preventDefault()}
>
<Check className="size-3.5" />
- </Button>
+ </IconButton>
{existingHref && (
- <Button
+ <IconButton
size="icon-xs"
variant="ghost"
- aria-label={t(($) => $.bubble_menu.link_edit.remove)}
+ label={t(($) => $.bubble_menu.link_edit.remove)}
onClick={remove}
onMouseDown={(e) => e.preventDefault()}
>
<Unlink className="size-3.5" />
- </Button>
+ </IconButton>
)}
- <Button
+ <IconButton
size="icon-xs"
variant="ghost"
- aria-label={t(($) => $.bubble_menu.link_edit.close)}
+ label={t(($) => $.bubble_menu.link_edit.close)}
onClick={() => { onClose(); editor.commands.focus(); }}
onMouseDown={(e) => e.preventDefault()}
>
<X className="size-3.5" />
- </Button>
+ </IconButton>
</div>
);
}
diff --git a/packages/views/editor/dynamic-block.tsx b/packages/views/editor/dynamic-block.tsx
index 5cbdd7bddb..e6ef10e05b 100644
--- a/packages/views/editor/dynamic-block.tsx
+++ b/packages/views/editor/dynamic-block.tsx
@@ -36,6 +36,7 @@ import {
Workflow,
} from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@multica/ui/components/ui/tabs";
import { Spinner } from "@multica/ui/components/ui/spinner";
import { copyText } from "@multica/ui/lib/clipboard";
@@ -180,30 +181,28 @@ export function DynamicBlock({
</TabsTrigger>
</TabsList>
{onFullscreen && (
- <Button
+ <IconButton
ref={fullscreenButtonRef}
type="button"
variant="ghost"
size="icon-xs"
className="text-muted-foreground"
onClick={onFullscreen}
- title={t(($) => $.code_block.fullscreen)}
- aria-label={t(($) => $.code_block.fullscreen)}
+ label={t(($) => $.code_block.fullscreen)}
>
<Maximize2 />
- </Button>
+ </IconButton>
)}
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
className="text-muted-foreground"
onClick={handleCopy}
- title={t(($) => $.dynamic_block.copy_source)}
- aria-label={t(($) => $.dynamic_block.copy_source)}
+ label={t(($) => $.dynamic_block.copy_source)}
>
{copied ? <Check /> : <Copy />}
- </Button>
+ </IconButton>
</div>
</div>
<TabsContent
diff --git a/packages/views/editor/extensions/code-block-view.test.tsx b/packages/views/editor/extensions/code-block-view.test.tsx
index 633595160d..2b10a99902 100644
--- a/packages/views/editor/extensions/code-block-view.test.tsx
+++ b/packages/views/editor/extensions/code-block-view.test.tsx
@@ -97,7 +97,7 @@ describe("CodeBlockView — html language toggle", () => {
});
const frame = document.querySelector("iframe");
expect(frame).toBeTruthy();
- const toggle = screen.getByTitle("Show source");
+ const toggle = screen.getByRole("button", { name: "Show source" });
fireEvent.click(toggle);
expect(document.querySelector("iframe")).toBe(frame);
expect(frame?.closest("[hidden]")).toBeTruthy();
@@ -140,7 +140,7 @@ describe("CodeBlockView — html language toggle", () => {
fireEvent.click(opener);
expect(screen.getByRole("dialog").querySelector("iframe")).toBe(original);
fireEvent.click(screen.getByRole("button", { name: "Close" }));
- fireEvent.click(screen.getByTitle("Show source"));
+ fireEvent.click(screen.getByRole("button", { name: "Show source" }));
expect(editorContent.closest("pre")?.className).not.toContain("sr-only");
fireEvent.click(opener);
expect(screen.getByRole("dialog").querySelector("iframe")).toBe(original);
@@ -149,8 +149,8 @@ describe("CodeBlockView — html language toggle", () => {
it("does not show the toggle or an iframe for a non-html language", () => {
render(<CodeBlockView {...makeProps("typescript", "const x = 1;")} />);
- expect(screen.queryByTitle("Show source")).toBeNull();
- expect(screen.queryByTitle("Show preview")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Show source" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Show preview" })).toBeNull();
expect(document.querySelector("iframe")).toBeNull();
});
@@ -162,7 +162,7 @@ describe("CodeBlockView — html language toggle", () => {
const editorContent = screen.getByTestId("nvc");
rerender(<CodeBlockView {...makeProps("html", "<p>pending</p>")} />);
- fireEvent.click(screen.getByTitle("Show source"));
+ fireEvent.click(screen.getByRole("button", { name: "Show source" }));
act(() => vi.advanceTimersByTime(250));
expect(frame.getAttribute("srcdoc")).toBe("<p>initial</p>");
rerender(<CodeBlockView {...makeProps("html", "<p>edited</p>")} />);
@@ -178,7 +178,7 @@ describe("CodeBlockView — html language toggle", () => {
rerender(<CodeBlockView {...makeProps("html", "<p>latest</p>")} />);
act(() => vi.advanceTimersByTime(250));
expect(frame.getAttribute("srcdoc")).toBe("<p>edited</p>");
- fireEvent.click(screen.getByTitle("Show preview"));
+ fireEvent.click(screen.getByRole("button", { name: "Show preview" }));
act(() => vi.advanceTimersByTime(250));
expect(frame.getAttribute("srcdoc")).toBe("<p>latest</p>");
expect(document.querySelector("iframe")).toBe(frame);
diff --git a/packages/views/editor/extensions/code-block-view.tsx b/packages/views/editor/extensions/code-block-view.tsx
index 3ba882bf78..1aea72549b 100644
--- a/packages/views/editor/extensions/code-block-view.tsx
+++ b/packages/views/editor/extensions/code-block-view.tsx
@@ -4,7 +4,8 @@ import { useState } from "react";
import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
import type { NodeViewProps } from "@tiptap/react";
import { Code as CodeIcon, Copy, Check, Eye, Maximize2 } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { HtmlPreviewSurface } from "../html-preview-surface";
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
@@ -104,54 +105,57 @@ function CodeBlockView({ node }: NodeViewProps) {
</span>
)}
{isHtml && (
- <button
- type="button"
- onClick={toggleView}
- className="flex h-6 w-6 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
- title={
- view === "preview"
- ? t(($) => $.code_block.show_source)
- : t(($) => $.code_block.show_preview)
- }
- aria-label={
+ <TooltipHint
+ label={
view === "preview"
? t(($) => $.code_block.show_source)
: t(($) => $.code_block.show_preview)
}
>
- {view === "preview" ? (
- <CodeIcon className="h-3.5 w-3.5" />
- ) : (
- <Eye className="h-3.5 w-3.5" />
- )}
- </button>
+ <button
+ type="button"
+ onClick={toggleView}
+ className="flex h-6 w-6 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
+ aria-label={
+ view === "preview"
+ ? t(($) => $.code_block.show_source)
+ : t(($) => $.code_block.show_preview)
+ }
+ >
+ {view === "preview" ? (
+ <CodeIcon className="h-3.5 w-3.5" />
+ ) : (
+ <Eye className="h-3.5 w-3.5" />
+ )}
+ </button>
+ </TooltipHint>
)}
{isHtml && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
className="text-muted-foreground"
- title={t(($) => $.code_block.fullscreen)}
- aria-label={t(($) => $.code_block.fullscreen)}
+ label={t(($) => $.code_block.fullscreen)}
onClick={() => setFullscreen(true)}
>
<Maximize2 className="h-3.5 w-3.5" />
- </Button>
+ </IconButton>
)}
- <button
- type="button"
- onClick={handleCopy}
- className="flex h-6 w-6 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
- title={t(($) => $.code_block.copy_code)}
- aria-label={t(($) => $.code_block.copy_code)}
- >
- {copied ? (
- <Check className="h-3.5 w-3.5" />
- ) : (
- <Copy className="h-3.5 w-3.5" />
- )}
- </button>
+ <TooltipHint label={t(($) => $.code_block.copy_code)}>
+ <button
+ type="button"
+ onClick={handleCopy}
+ className="flex h-6 w-6 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
+ aria-label={t(($) => $.code_block.copy_code)}
+ >
+ {copied ? (
+ <Check className="h-3.5 w-3.5" />
+ ) : (
+ <Copy className="h-3.5 w-3.5" />
+ )}
+ </button>
+ </TooltipHint>
</div>
{/* `<pre>` + NodeViewContent must remain mounted so the user can keep
editing the code block contents. When the HTML preview is showing
diff --git a/packages/views/editor/link-hover-card.tsx b/packages/views/editor/link-hover-card.tsx
index 4a85f1cb2e..132434cd16 100644
--- a/packages/views/editor/link-hover-card.tsx
+++ b/packages/views/editor/link-hover-card.tsx
@@ -14,7 +14,7 @@ import { createPortal } from "react-dom";
import { computePosition, offset, flip, shift } from "@floating-ui/dom";
import { ExternalLink, Copy } from "lucide-react";
import { toast } from "sonner";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { copyText } from "@multica/ui/lib/clipboard";
import { useWorkspaceSlug } from "@multica/core/paths";
import { useAppOrigin } from "../navigation";
@@ -209,24 +209,24 @@ function LinkHoverCard({
>
{truncateUrl(href)}
</span>
- <Button
+ <IconButton
size="icon-xs"
variant="ghost"
className="text-muted-foreground"
onClick={handleCopy}
- title={t(($) => $.link_hover.copy_link)}
+ label={t(($) => $.link_hover.copy_link)}
>
<Copy className="size-3.5" />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
size="icon-xs"
variant="ghost"
className="text-muted-foreground"
onClick={handleOpen}
- title={t(($) => $.link_hover.open_link)}
+ label={t(($) => $.link_hover.open_link)}
>
<ExternalLink className="size-3.5" />
- </Button>
+ </IconButton>
</div>,
document.body,
);
diff --git a/packages/views/editor/mermaid-diagram.tsx b/packages/views/editor/mermaid-diagram.tsx
index 40cfb65b0a..5b5903499b 100644
--- a/packages/views/editor/mermaid-diagram.tsx
+++ b/packages/views/editor/mermaid-diagram.tsx
@@ -41,6 +41,7 @@ import {
} from "react";
import { Check, Copy, Frame, Maximize2, Minus, Plus } from "lucide-react";
import { copyText } from "@multica/ui/lib/clipboard";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useT } from "../i18n";
import { DYNAMIC_BLOCK_COLLAPSE_AT_PX, DynamicBlockSkeleton } from "./dynamic-block";
import { useDragToScroll } from "./hooks/use-drag-to-scroll";
@@ -522,14 +523,15 @@ export function MermaidDiagram({
<div ref={containerRef} className="mermaid-diagram mermaid-diagram-error">
<div className="mermaid-diagram-error-head">
<p>{t(($) => $.mermaid.render_error)}</p>
- <button
- type="button"
- onClick={handleCopySource}
- title={t(($) => $.mermaid.copy_source)}
- aria-label={t(($) => $.mermaid.copy_source)}
- >
- {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
- </button>
+ <TooltipHint label={t(($) => $.mermaid.copy_source)}>
+ <button
+ type="button"
+ onClick={handleCopySource}
+ aria-label={t(($) => $.mermaid.copy_source)}
+ >
+ {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
+ </button>
+ </TooltipHint>
</div>
{/* The parser message is the only clue about which line is wrong;
without it the fallback is just an unexplained code block. */}
@@ -596,23 +598,25 @@ export function MermaidDiagram({
{!frame && (
<div className="mermaid-diagram-toolbar">
<MermaidZoomControls zoom={zoom} />
- <button
- type="button"
- onClick={handleCopySource}
- title={t(($) => $.mermaid.copy_source)}
- aria-label={t(($) => $.mermaid.copy_source)}
- >
- {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
- </button>
- <button
- ref={expandButtonRef}
- type="button"
- onClick={() => setViewerOpen(true)}
- title={t(($) => $.mermaid.open_viewer)}
- aria-label={t(($) => $.mermaid.open_viewer)}
- >
- <Maximize2 className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.mermaid.copy_source)}>
+ <button
+ type="button"
+ onClick={handleCopySource}
+ aria-label={t(($) => $.mermaid.copy_source)}
+ >
+ {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
+ </button>
+ </TooltipHint>
+ <TooltipHint label={t(($) => $.mermaid.open_viewer)}>
+ <button
+ ref={expandButtonRef}
+ type="button"
+ onClick={() => setViewerOpen(true)}
+ aria-label={t(($) => $.mermaid.open_viewer)}
+ >
+ <Maximize2 className="size-3.5" />
+ </button>
+ </TooltipHint>
</div>
)}
<MermaidViewer
@@ -645,36 +649,39 @@ function MermaidZoomControls({ zoom }: { zoom: InlineZoom }) {
return (
<div className="mermaid-diagram-zoom">
- <button
- type="button"
- onClick={zoom.zoomOut}
- disabled={!zoom.canZoomOut}
- title={t(($) => $.canvas.zoom_out)}
- aria-label={t(($) => $.canvas.zoom_out)}
- >
- <Minus className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.canvas.zoom_out)}>
+ <button
+ type="button"
+ onClick={zoom.zoomOut}
+ disabled={!zoom.canZoomOut}
+ aria-label={t(($) => $.canvas.zoom_out)}
+ >
+ <Minus className="size-3.5" />
+ </button>
+ </TooltipHint>
{/* Not a live region: a fitted preview's percent follows the column's
width, and every diagram on the page would announce each resize. */}
<span>{zoom.zoomPercent}%</span>
- <button
- type="button"
- onClick={zoom.zoomIn}
- disabled={!zoom.canZoomIn}
- title={t(($) => $.canvas.zoom_in)}
- aria-label={t(($) => $.canvas.zoom_in)}
- >
- <Plus className="size-3.5" />
- </button>
- <button
- type="button"
- onClick={zoom.fit}
- disabled={zoom.fitted}
- title={t(($) => $.canvas.zoom_fit)}
- aria-label={t(($) => $.canvas.zoom_fit)}
- >
- <Frame className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.canvas.zoom_in)}>
+ <button
+ type="button"
+ onClick={zoom.zoomIn}
+ disabled={!zoom.canZoomIn}
+ aria-label={t(($) => $.canvas.zoom_in)}
+ >
+ <Plus className="size-3.5" />
+ </button>
+ </TooltipHint>
+ <TooltipHint label={t(($) => $.canvas.zoom_fit)}>
+ <button
+ type="button"
+ onClick={zoom.fit}
+ disabled={zoom.fitted}
+ aria-label={t(($) => $.canvas.zoom_fit)}
+ >
+ <Frame className="size-3.5" />
+ </button>
+ </TooltipHint>
</div>
);
}
diff --git a/packages/views/editor/mermaid-viewer.tsx b/packages/views/editor/mermaid-viewer.tsx
index 2b03c378cb..7fb526cda3 100644
--- a/packages/views/editor/mermaid-viewer.tsx
+++ b/packages/views/editor/mermaid-viewer.tsx
@@ -27,6 +27,7 @@ import {
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
import { Dialog, DialogContent, DialogTitle } from "@multica/ui/components/ui/dialog";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
DropdownMenu,
DropdownMenuContent,
@@ -82,16 +83,17 @@ function ToolbarButton({
children: React.ReactNode;
}) {
return (
- <button
- type="button"
- onClick={onClick}
- disabled={disabled}
- title={label}
- aria-label={label}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground disabled:pointer-events-none disabled:opacity-40"
- >
- {children}
- </button>
+ <TooltipHint label={label} side="bottom">
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={disabled}
+ aria-label={label}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground disabled:pointer-events-none disabled:opacity-40"
+ >
+ {children}
+ </button>
+ </TooltipHint>
);
}
@@ -226,18 +228,19 @@ function MermaidViewerContent({
{copied ? <Check className="size-4" /> : <Copy className="size-4" />}
</ToolbarButton>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- title={t(($) => $.mermaid.export)}
- aria-label={t(($) => $.mermaid.export)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
- >
- <Download className="size-4" />
- </button>
- }
- />
+ <TooltipHint label={t(($) => $.mermaid.export)} side="bottom">
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.mermaid.export)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
+ >
+ <Download className="size-4" />
+ </button>
+ }
+ />
+ </TooltipHint>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={handleDownloadPng} disabled={!canExportImage}>
<ImageIcon className="size-4" />
diff --git a/packages/views/editor/preview-sequence-context.test.tsx b/packages/views/editor/preview-sequence-context.test.tsx
index e7e09c0028..adbd638993 100644
--- a/packages/views/editor/preview-sequence-context.test.tsx
+++ b/packages/views/editor/preview-sequence-context.test.tsx
@@ -644,7 +644,7 @@ describe("body images with no attachment record", () => {
render(<CaptionedBody captions={[caption]} />);
act(() => {
- fireEvent.click(screen.getAllByTitle("View")[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: "View" })[0]!);
});
expect(
@@ -658,7 +658,7 @@ describe("body images with no attachment record", () => {
render(<CaptionedBody captions={["报告图表", "对比图"]} />);
act(() => {
- fireEvent.click(screen.getAllByTitle("View")[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: "View" })[0]!);
});
expectCounter("1 / 2");
diff --git a/packages/views/inbox/components/inbox-filter-menu.tsx b/packages/views/inbox/components/inbox-filter-menu.tsx
index 1b3b770016..a1938c2bca 100644
--- a/packages/views/inbox/components/inbox-filter-menu.tsx
+++ b/packages/views/inbox/components/inbox-filter-menu.tsx
@@ -19,6 +19,7 @@ import { archivedInboxFacetsOptions } from "@multica/core/inbox/queries";
import { useActorName } from "@multica/core/workspace/hooks";
import type { InboxItem } from "@multica/core/types";
import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Button } from "@multica/ui/components/ui/button";
import {
DropdownMenu,
@@ -215,11 +216,11 @@ export function InboxFilterMenu({
<DropdownMenu open={open} onOpenChange={setOpen}>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant={activeCount > 0 ? "default" : "ghost"}
size="icon-sm"
- aria-label={triggerLabel}
- title={triggerLabel}
+ label={triggerLabel}
+ tooltipSide="bottom"
className={cn(
"text-muted-foreground",
activeCount > 0 &&
diff --git a/packages/views/inbox/components/inbox-list-item.tsx b/packages/views/inbox/components/inbox-list-item.tsx
index 26e0810b4b..4bbc882ab9 100644
--- a/packages/views/inbox/components/inbox-list-item.tsx
+++ b/packages/views/inbox/components/inbox-list-item.tsx
@@ -6,6 +6,7 @@ import {
IssueAgentActivityIndicator,
} from "../../issues/components/issue-agent-activity-indicator";
import { ActorAvatar } from "../../common/actor-avatar";
+import { DeferredTooltip } from "../../common/deferred-tooltip";
import { Archive, ArchiveRestore } from "lucide-react";
import type { InboxItem } from "@multica/core/types";
import type { InboxView } from "./inbox-view";
@@ -154,24 +155,27 @@ export function InboxListItem({
focus anywhere in the row so it is reachable by Tab. Touch has
neither, so it stays hidden on a pointer that cannot hover and
the compact menu below carries the same action. */}
- <button
- type="button"
- title={actionLabel}
- aria-label={actionLabel}
- onClick={(e) => {
- e.stopPropagation();
- onAction();
- }}
- className="hidden rounded-xs p-0.5 text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring [@media(hover:hover)]:group-hover:inline-flex [@media(hover:hover)]:group-focus-within:inline-flex"
- >
- <ActionIcon className="h-3.5 w-3.5" />
- </button>
+ <DeferredTooltip
+ content={actionLabel}
+ trigger={
+ <button
+ type="button"
+ aria-label={actionLabel}
+ onClick={(e) => {
+ e.stopPropagation();
+ onAction();
+ }}
+ className="hidden rounded-xs p-0.5 text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring [@media(hover:hover)]:group-hover:inline-flex [@media(hover:hover)]:group-focus-within:inline-flex"
+ >
+ <ActionIcon className="h-3.5 w-3.5" />
+ </button>
+ }
+ />
<InboxRowMenu item={item} view={view} />
{item.issue_status && (
// Icon-only, like every other issue row — but a colour is not a
// name, and this row has no space for the CustomStatusChip the
- // board card and list row carry. `title` is that name, and it is
- // the same affordance the archive button above already uses.
+ // board card and list row carry. `title` is that name.
<span
title={statusLabelOf(item.issue_status)}
className="flex shrink-0 items-center"
diff --git a/packages/views/inbox/components/inbox-page.test.tsx b/packages/views/inbox/components/inbox-page.test.tsx
index ab2d939bce..97c07f552c 100644
--- a/packages/views/inbox/components/inbox-page.test.tsx
+++ b/packages/views/inbox/components/inbox-page.test.tsx
@@ -479,7 +479,12 @@ describe("InboxPage", () => {
render(<InboxPage />);
expect(screen.queryByTestId("row")).toBeNull();
- fireEvent.click(screen.getByRole("button", { name: "Inbox" }));
+ // The test's `useT` names every control "Inbox"; the header's batch menu
+ // shares the name, so skip the menu trigger.
+ const clearFilters = screen
+ .getAllByRole("button", { name: "Inbox" })
+ .find((button) => !button.hasAttribute("aria-haspopup"));
+ fireEvent.click(clearFilters!);
expect(screen.getByTestId("row")).toHaveTextContent("todo-high");
});
diff --git a/packages/views/inbox/components/inbox-page.tsx b/packages/views/inbox/components/inbox-page.tsx
index 995fa78db8..17efcde1a7 100644
--- a/packages/views/inbox/components/inbox-page.tsx
+++ b/packages/views/inbox/components/inbox-page.tsx
@@ -52,6 +52,7 @@ import {
} from "@multica/core/inbox/filter-store";
import { IssueDetail, issueHighlightMementoKey } from "../../issues/components/issue-detail";
+import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";
import { IssuePeekHost } from "../../issues/components/issue-peek";
import { useIssueSurfaceActivity } from "../../issues/surface/activity";
import { useViewStateWriter } from "../../platform";
@@ -71,6 +72,12 @@ import {
} from "lucide-react";
import type { InboxItem } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@multica/ui/components/ui/tooltip";
import {
ResizablePanelGroup,
ResizablePanel,
@@ -111,6 +118,7 @@ const INBOX_LIST_MAX_SIZE = 400;
export function InboxPage() {
const queryClient = useQueryClient();
const { t } = useT("inbox");
+ const { t: tCommon } = useT("common");
const showIssueLimitUpgradePrompt = useIssueLimitUpgradePrompt();
const showAutopilotQuotaRecoveryPrompt = useIssueLimitUpgradePrompt(
"autopilot_quota",
@@ -605,9 +613,9 @@ export function InboxPage() {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
- variant="ghost"
- size="icon-sm"
+ <IconButton
+ label={tCommon(($) => $.more_actions)}
+ tooltipSide="bottom"
className="text-muted-foreground"
/>
}
@@ -879,25 +887,35 @@ export function InboxPage() {
)}
{/* Mirrors the row action: the button always reverses the view the
item is being read in. */}
- {isArchivedView ? (
- <Button
- variant="outline"
- size="sm"
- onClick={() => handleUnarchive(detailItem.id)}
- >
- <ArchiveRestore className="mr-1.5 h-3.5 w-3.5" />
- {t(($) => $.detail.unarchive)}
- </Button>
- ) : (
- <Button
- variant="outline"
- size="sm"
- onClick={() => handleArchive(detailItem.id)}
- >
- <Archive className="mr-1.5 h-3.5 w-3.5" />
- {t(($) => $.detail.archive)}
- </Button>
- )}
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ isArchivedView ? (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => handleUnarchive(detailItem.id)}
+ >
+ <ArchiveRestore className="mr-1.5 h-3.5 w-3.5" />
+ {t(($) => $.detail.unarchive)}
+ </Button>
+ ) : (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => handleArchive(detailItem.id)}
+ >
+ <Archive className="mr-1.5 h-3.5 w-3.5" />
+ {t(($) => $.detail.archive)}
+ </Button>
+ )
+ }
+ />
+ <TooltipContent side="bottom">
+ {isArchivedView ? t(($) => $.detail.unarchive) : t(($) => $.detail.archive)}
+ <ActionShortcutKeycaps action="archiveInboxItem" />
+ </TooltipContent>
+ </Tooltip>
</div>
</div>
) : null;
diff --git a/packages/views/issues/components/board-card.tsx b/packages/views/issues/components/board-card.tsx
index 41b79d7bd9..a5b5ad3db0 100644
--- a/packages/views/issues/components/board-card.tsx
+++ b/packages/views/issues/components/board-card.tsx
@@ -133,6 +133,7 @@ export const BoardCardContent = memo(function BoardCardContent({
<PriorityPicker
priority={issue.priority}
onUpdate={handleUpdate}
+ tooltip={priorityLabel}
triggerRender={
<button
type="button"
@@ -271,6 +272,7 @@ export const BoardCardContent = memo(function BoardCardContent({
<StartDatePicker
startDate={issue.start_date}
onUpdate={handleUpdate}
+ tooltip={t(($) => $.detail.prop_start_date)}
trigger={
<span className="flex items-center gap-1 text-caption text-muted-foreground">
<CalendarClock className="size-3" />
@@ -292,6 +294,7 @@ export const BoardCardContent = memo(function BoardCardContent({
<DueDatePicker
dueDate={issue.due_date}
onUpdate={handleUpdate}
+ tooltip={t(($) => $.detail.prop_due_date)}
trigger={
<span
className={`flex items-center gap-1 text-caption ${
diff --git a/packages/views/issues/components/board-column.tsx b/packages/views/issues/components/board-column.tsx
index 526549c83f..4535cdc8ac 100644
--- a/packages/views/issues/components/board-column.tsx
+++ b/packages/views/issues/components/board-column.tsx
@@ -138,6 +138,7 @@ export const BoardColumn = memo(function BoardColumn({
const viewBaseline = useViewBaseline();
const statusFixedByView = !!status && viewBaseline?.status.has(status) === true;
const { t } = useT("issues");
+ const { t: tCommon } = useT("common");
// Resolve IDs to Issue objects, preserving parent-provided order
const resolvedIssues = useMemo(
@@ -229,19 +230,35 @@ export const BoardColumn = memo(function BoardColumn({
{status && (
<DeferredPopup
ariaHasPopup="menu"
+ tooltip={tCommon(($) => $.more_actions)}
triggerRender={
- <Button variant="ghost" size="icon-sm" className="rounded-full text-muted-foreground">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className="rounded-full text-muted-foreground"
+ aria-label={tCommon(($) => $.more_actions)}
+ >
<MoreHorizontal className="size-3.5" />
</Button>
}
>
{(open, onOpenChange) => (
<DropdownMenu open={open} onOpenChange={onOpenChange}>
- <DropdownMenuTrigger
- render={
- <Button variant="ghost" size="icon-sm" className="rounded-full text-muted-foreground">
- <MoreHorizontal className="size-3.5" />
- </Button>
+ <DeferredTooltip
+ content={tCommon(($) => $.more_actions)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className="rounded-full text-muted-foreground"
+ aria-label={tCommon(($) => $.more_actions)}
+ >
+ <MoreHorizontal className="size-3.5" />
+ </Button>
+ }
+ />
}
/>
<DropdownMenuContent align="end">
@@ -266,6 +283,7 @@ export const BoardColumn = memo(function BoardColumn({
variant="ghost"
size="icon-sm"
className="rounded-full text-muted-foreground"
+ aria-label={t(($) => $.board.add_issue_tooltip)}
onClick={() => {
const data = {
...(group.createData ?? {}),
diff --git a/packages/views/issues/components/comment-card.test.tsx b/packages/views/issues/components/comment-card.test.tsx
index e2f2e1d1a2..d48c16832b 100644
--- a/packages/views/issues/components/comment-card.test.tsx
+++ b/packages/views/issues/components/comment-card.test.tsx
@@ -129,7 +129,7 @@ describe("AttachmentList — layout (MUL-7649)", () => {
expect(screen.getByText("MD · 2 KB")).toBeTruthy();
expect(screen.getByText("CSV · 2 KB")).toBeTruthy();
// The row form's Eye button is gone — the whole card opens the file.
- expect(screen.queryByTitle("Preview")).toBeNull();
+ expect(screen.queryByRole("button", { name: "Preview" })).toBeNull();
});
// MUL-7736: several screenshots used to shrink into one row of thumbnails,
diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsx
index 4ab97dea99..7ea4a5ca15 100644
--- a/packages/views/issues/components/comment-card.tsx
+++ b/packages/views/issues/components/comment-card.tsx
@@ -24,6 +24,7 @@ import {
AlertDialogTitle,
} from "@multica/ui/components/ui/alert-dialog";
import { ActorAvatar } from "../../common/actor-avatar";
+import { DeferredTooltip } from "../../common/deferred-tooltip";
import { ReactionBar } from "@multica/ui/components/common/reaction-bar";
import { QuickEmojiPicker } from "@multica/ui/components/common/quick-emoji-picker";
import { cn } from "@multica/ui/lib/utils";
@@ -739,16 +740,21 @@ function CommentRow({
className={buttonVariants({ variant: "ghost", size: "icon-sm", className: commentActionClassName })}
/>}
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- variant="ghost"
- size="icon-sm"
- className={commentActionClassName}
- aria-label={t(($) => $.comment.more_actions)}
- >
- <MoreHorizontal className="h-4 w-4" aria-hidden />
- </Button>
+ <DeferredTooltip
+ content={t(($) => $.comment.more_actions)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className={commentActionClassName}
+ aria-label={t(($) => $.comment.more_actions)}
+ >
+ <MoreHorizontal className="h-4 w-4" aria-hidden />
+ </Button>
+ }
+ />
}
/>
<DropdownMenuContent align="end">
@@ -1125,6 +1131,7 @@ function CommentCardImpl({
const reactions = entry.reactions ?? [];
const isHighlighted = highlightedCommentId === entry.id;
+ const toggleLabel = open ? t(($) => $.comment.collapse_thread) : t(($) => $.comment.expand_thread);
// Reply-resolution display. When a REPLY is the thread's resolution, the other
// replies fold behind a bar and the resolution stays visible (root-resolution
@@ -1245,19 +1252,23 @@ function CommentCardImpl({
)}
<div data-comment-actions className="ml-auto flex shrink-0 items-center gap-0.5">
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- aria-label={open ? t(($) => $.comment.collapse_thread) : t(($) => $.comment.expand_thread)}
- title={open ? t(($) => $.comment.collapse_thread) : t(($) => $.comment.expand_thread)}
- aria-expanded={open}
- aria-controls={open ? `comment-body-${entry.id}` : undefined}
- onClick={handleToggle}
- className={commentActionClassName}
- >
- <ChevronRight aria-hidden className={cn("h-3.5 w-3.5 transition-transform motion-reduce:transition-none", open && "rotate-90")} />
- </Button>
+ <DeferredTooltip
+ content={toggleLabel}
+ trigger={
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={toggleLabel}
+ aria-expanded={open}
+ aria-controls={open ? `comment-body-${entry.id}` : undefined}
+ onClick={handleToggle}
+ className={commentActionClassName}
+ >
+ <ChevronRight aria-hidden className={cn("h-3.5 w-3.5 transition-transform motion-reduce:transition-none", open && "rotate-90")} />
+ </Button>
+ }
+ />
{open && !deleted && <>
{!edit.editing && <QuickEmojiPicker
onSelect={(emoji) => onToggleReaction(entry.id, emoji)}
@@ -1266,16 +1277,21 @@ function CommentCardImpl({
className={buttonVariants({ variant: "ghost", size: "icon-sm", className: commentActionClassName })}
/>}
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- variant="ghost"
- size="icon-sm"
- className={commentActionClassName}
- aria-label={t(($) => $.comment.more_actions)}
- >
- <MoreHorizontal className="h-4 w-4" aria-hidden />
- </Button>
+ <DeferredTooltip
+ content={t(($) => $.comment.more_actions)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className={commentActionClassName}
+ aria-label={t(($) => $.comment.more_actions)}
+ >
+ <MoreHorizontal className="h-4 w-4" aria-hidden />
+ </Button>
+ }
+ />
}
/>
<DropdownMenuContent align="end">
diff --git a/packages/views/issues/components/comment-composers.test.tsx b/packages/views/issues/components/comment-composers.test.tsx
index 796eb8bf27..335f362342 100644
--- a/packages/views/issues/components/comment-composers.test.tsx
+++ b/packages/views/issues/components/comment-composers.test.tsx
@@ -274,6 +274,12 @@ function activateComposer(shellTestId: "comment-composer-shell" | "reply-compose
fireEvent.click(screen.getByTestId(shellTestId));
}
+/** Native `disabled` while empty or sending; `aria-disabled` while an upload
+ * blocks it, so the reason tooltip stays reachable. */
+function isSendBlocked(button: HTMLButtonElement): boolean {
+ return button.disabled || button.getAttribute("aria-disabled") === "true";
+}
+
function getSubmitButton(container: HTMLElement): HTMLButtonElement {
// Submit is always the last button in a composer's action cluster.
const buttons = container.querySelectorAll("button");
@@ -629,7 +635,7 @@ describe("comment composers", () => {
resolveSubmit(true);
// Success: the composer clears (now empty → submit disabled, lock released).
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
expect(screen.getByTestId("editor").closest("[aria-busy]")).toBeNull();
});
@@ -827,7 +833,7 @@ describe("comment composers", () => {
await waitFor(() => expect(onSubmit).toHaveBeenCalled());
// Failed send must NOT clear — the box still has content, submit stays live.
- await waitFor(() => expect(getSubmitButton(container)).not.toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(false));
});
});
@@ -880,7 +886,7 @@ describe("comment composers — upload submit gate", () => {
const pending = startPendingUpload(container);
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
// Screen readers must hear "busy", not just a dead control.
expect(getSubmitButton(container)).toHaveAttribute("aria-busy", "true");
@@ -888,7 +894,7 @@ describe("comment composers — upload submit gate", () => {
pending.resolve(uploadAttachment("att-1", "https://cdn.example/att-1.png"));
});
- await waitFor(() => expect(getSubmitButton(container)).not.toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(false));
expect(getSubmitButton(container)).not.toHaveAttribute("aria-busy");
});
@@ -903,7 +909,7 @@ describe("comment composers — upload submit gate", () => {
activateComposer("comment-composer-shell");
const pending = startPendingUpload(container, "mine.png");
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
expect(insertPlaceholderSpy).not.toHaveBeenCalled();
await act(async () => {
@@ -956,7 +962,7 @@ describe("comment composers — upload submit gate", () => {
activateComposer("comment-composer-shell");
const pending = startPendingUpload(container, "doomed.png");
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
await act(async () => {
pending.fail();
@@ -1032,7 +1038,7 @@ describe("comment composers — upload submit gate", () => {
// Draft + pending upload mount the editor directly (no shell).
const editor = await screen.findByTestId("editor");
- expect(getSubmitButton(container)).toBeDisabled();
+ expect(isSendBlocked(getSubmitButton(container))).toBe(true);
expect(getSubmitButton(container)).toHaveAttribute("aria-busy", "true");
// The shortcut path bypasses the button — the submit-time re-read of the
@@ -1052,7 +1058,7 @@ describe("comment composers — upload submit gate", () => {
uploadAttachment("att-prev", "https://cdn.example/att-prev.png"),
);
});
- await waitFor(() => expect(getSubmitButton(container)).not.toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(false));
fireEvent.keyDown(editor, { key: "Enter", metaKey: true });
await waitFor(() => expect(onSubmit).toHaveBeenCalled());
});
@@ -1065,18 +1071,18 @@ describe("comment composers — upload submit gate", () => {
const first = startPendingUpload(container, "a.png");
const second = startPendingUpload(container, "b.png");
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
// First one lands — the second is still in flight, so send must stay shut.
await act(async () => {
first.resolve(uploadAttachment("att-a", "https://cdn.example/att-a.png"));
});
- expect(getSubmitButton(container)).toBeDisabled();
+ expect(isSendBlocked(getSubmitButton(container))).toBe(true);
await act(async () => {
second.resolve(uploadAttachment("att-b", "https://cdn.example/att-b.png"));
});
- await waitFor(() => expect(getSubmitButton(container)).not.toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(false));
});
it("re-enables send after a FAILED upload so the draft isn't stuck", async () => {
@@ -1085,14 +1091,14 @@ describe("comment composers — upload submit gate", () => {
fireEvent.change(screen.getByTestId("editor"), { target: { value: "will fail" } });
const pending = startPendingUpload(container);
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
// uploadWithToast reports the failure and resolves null — the placeholder
// is dropped and the body never referenced it, so submit must come back.
await act(async () => {
pending.fail();
});
- await waitFor(() => expect(getSubmitButton(container)).not.toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(false));
});
it("sends the attachment id once the upload completes", async () => {
@@ -1105,7 +1111,7 @@ describe("comment composers — upload submit gate", () => {
pending.resolve(uploadAttachment("att-9", "https://cdn.example/att-9.png"));
});
- await waitFor(() => expect(getSubmitButton(container)).not.toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(false));
fireEvent.click(getSubmitButton(container));
await waitFor(() =>
@@ -1231,7 +1237,7 @@ describe("comment composers — upload submit gate", () => {
startPendingUpload(container);
- await waitFor(() => expect(getSubmitButton(container)).toBeDisabled());
+ await waitFor(() => expect(isSendBlocked(getSubmitButton(container))).toBe(true));
expect(getSubmitButton(container)).toHaveAttribute("aria-busy", "true");
});
@@ -1314,7 +1320,7 @@ describe.each(["reply", "description"])("annotations in %s drafts", (source) =>
useCommentDraftStore.getState().addAnnotation(draftKey, { ...annotation, note: "" });
const onSubmit = vi.fn().mockResolvedValue(false);
renderAnnotatedComposer(onSubmit);
- expect(screen.getByRole("button", { name: "Send" })).toBeDisabled();
+ expect(isSendBlocked(screen.getByRole("button", { name: "Send" }) as HTMLButtonElement)).toBe(true);
expect(screen.queryByRole("button", { name: /1 annotation/ })).not.toBeInTheDocument();
act(() => { useCommentDraftStore.getState().addAnnotation(draftKey, { ...annotation, note: "New note" }); });
fireEvent.click(screen.getByRole("button", { name: "Send" }));
diff --git a/packages/views/issues/components/comment-input.tsx b/packages/views/issues/components/comment-input.tsx
index b0561feb5b..32278a1987 100644
--- a/packages/views/issues/components/comment-input.tsx
+++ b/packages/views/issues/components/comment-input.tsx
@@ -7,7 +7,8 @@ import { FileUploadButton } from "@multica/ui/components/common/file-upload-butt
import { SubmitButton } from "@multica/ui/components/common/submit-button";
import { Button } from "@multica/ui/components/ui/button";
import { contentReferencesAttachment, type AgentTask } from "@multica/core/types";
-import { formatShortcut, useShortcut } from "@multica/core/shortcuts";
+import { useShortcut } from "@multica/core/shortcuts";
+import { ShortcutKeycaps } from "../../common/shortcut-keycaps";
import { useCommentDraftStore } from "@multica/core/issues/stores";
import { composeAnnotatedReply, hasReplyIntent } from "@multica/core/drafts/reply-annotation";
import { ReplyAnnotations } from "./reply-annotations";
@@ -329,13 +330,19 @@ function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation }: Comme
disabled={!canSend}
loading={submitting}
busy={gate.uploading}
- tooltip={gate.uploading
+ disabledReason={gate.uploading
? tEditor(($) => $.upload.in_progress)
: !canSend && annotations.length > 0
? t(($) => $.reply.annotations.intent_hint)
- : sendShortcut
- ? `${t(($) => $.comment.send_tooltip)} · ${formatShortcut(sendShortcut)}`
- : t(($) => $.comment.send_tooltip)}
+ : undefined}
+ tooltip={sendShortcut
+ ? (
+ <>
+ {t(($) => $.comment.send_tooltip)}
+ <ShortcutKeycaps shortcut={sendShortcut} decorative />
+ </>
+ )
+ : t(($) => $.comment.send_tooltip)}
ariaLabel={gate.uploading
? tEditor(($) => $.upload.in_progress)
: t(($) => $.comment.send_tooltip)}
diff --git a/packages/views/issues/components/deliverables/deliverable-details.tsx b/packages/views/issues/components/deliverables/deliverable-details.tsx
index 9b2e679b8e..80ff2121b0 100644
--- a/packages/views/issues/components/deliverables/deliverable-details.tsx
+++ b/packages/views/issues/components/deliverables/deliverable-details.tsx
@@ -15,6 +15,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { cn } from "@multica/ui/lib/utils";
import { useLocale, useT, useTimeAgo } from "../../../i18n";
import { ActorAvatar } from "../../../common/actor-avatar";
@@ -250,32 +251,32 @@ function DeliverableInfo({
{siblings.map((sibling) => {
const current = sibling.key === item.key;
return (
- <button
- key={sibling.key}
- type="button"
- className={cn(
- "aspect-square overflow-hidden rounded-md ring-1 transition-shadow",
- current
- ? "ring-2 ring-foreground"
- : "ring-border hover:ring-foreground/40",
- )}
- title={sibling.filename}
- aria-label={sibling.filename}
- aria-current={current || undefined}
- onClick={() => controls.goTo(sibling.key)}
- >
- {sibling.attachment ? (
- <DeliverableThumbnail
- attachment={sibling.attachment}
- showTypeLabel={false}
- className="size-full"
- />
- ) : (
- <span className="flex size-full items-center justify-center bg-muted text-muted-foreground">
- <ImageIcon className="size-4" />
- </span>
- )}
- </button>
+ <TooltipHint key={sibling.key} label={sibling.filename}>
+ <button
+ type="button"
+ className={cn(
+ "aspect-square overflow-hidden rounded-md ring-1 transition-shadow",
+ current
+ ? "ring-2 ring-foreground"
+ : "ring-border hover:ring-foreground/40",
+ )}
+ aria-label={sibling.filename}
+ aria-current={current || undefined}
+ onClick={() => controls.goTo(sibling.key)}
+ >
+ {sibling.attachment ? (
+ <DeliverableThumbnail
+ attachment={sibling.attachment}
+ showTypeLabel={false}
+ className="size-full"
+ />
+ ) : (
+ <span className="flex size-full items-center justify-center bg-muted text-muted-foreground">
+ <ImageIcon className="size-4" />
+ </span>
+ )}
+ </button>
+ </TooltipHint>
);
})}
</div>
diff --git a/packages/views/issues/components/deliverables/deliverables-overview.tsx b/packages/views/issues/components/deliverables/deliverables-overview.tsx
index b09e9ce986..5e02dde0fd 100644
--- a/packages/views/issues/components/deliverables/deliverables-overview.tsx
+++ b/packages/views/issues/components/deliverables/deliverables-overview.tsx
@@ -6,6 +6,7 @@ import type { DeliverableFile } from "@multica/core/attachments/deliverables";
import type { TimelineEntry } from "@multica/core/types";
import { useActorName } from "@multica/core/workspace/hooks";
import { Dialog, DialogContent, DialogTitle } from "@multica/ui/components/ui/dialog";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useLocale, useT, useTimeAgo } from "../../../i18n";
import { ActorAvatar } from "../../../common/actor-avatar";
import { formatBytes } from "../../../common/format-bytes";
@@ -233,15 +234,16 @@ function OverviewBody({
<SegmentedToggle value={filter} options={filterOptions} onChange={setFilter} />
</div>
<div className="flex items-center justify-self-end" style={NO_DRAG}>
- <button
- type="button"
- className="flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
- title={t(($) => $.deliverables.overview_close)}
- aria-label={t(($) => $.deliverables.overview_close)}
- onClick={onClose}
- >
- <X className="size-4" />
- </button>
+ <TooltipHint label={t(($) => $.deliverables.overview_close)} side="bottom">
+ <button
+ type="button"
+ className="flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
+ aria-label={t(($) => $.deliverables.overview_close)}
+ onClick={onClose}
+ >
+ <X className="size-4" />
+ </button>
+ </TooltipHint>
</div>
</header>
diff --git a/packages/views/issues/components/deliverables/deliverables-section.tsx b/packages/views/issues/components/deliverables/deliverables-section.tsx
index 3ae03fab7b..3ebf01d828 100644
--- a/packages/views/issues/components/deliverables/deliverables-section.tsx
+++ b/packages/views/issues/components/deliverables/deliverables-section.tsx
@@ -3,6 +3,7 @@
import { useState } from "react";
import { ChevronRight, LayoutGrid } from "lucide-react";
import type { DeliverableFile } from "@multica/core/attachments/deliverables";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useT } from "../../../i18n";
import { formatBytes } from "../../../common/format-bytes";
import { fileIcon } from "../../../editor/utils/file-icon";
@@ -64,20 +65,20 @@ export function DeliverablesSection({
{images.length > 0 && (
<div className="mb-1.5 grid grid-cols-3 gap-1.5">
{images.map((file) => (
- <button
- key={file.key}
- type="button"
- className="relative aspect-[4/3] overflow-hidden rounded-md ring-1 ring-border transition-shadow hover:ring-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- title={file.latest.filename}
- aria-label={versionedName(file, t)}
- onClick={() => openAttachment(file.latest)}
- >
- <DeliverableThumbnail
- attachment={file.latest}
- showTypeLabel={false}
- className="size-full"
- />
- </button>
+ <TooltipHint key={file.key} label={file.latest.filename}>
+ <button
+ type="button"
+ className="relative aspect-[4/3] overflow-hidden rounded-md ring-1 ring-border transition-shadow hover:ring-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ aria-label={versionedName(file, t)}
+ onClick={() => openAttachment(file.latest)}
+ >
+ <DeliverableThumbnail
+ attachment={file.latest}
+ showTypeLabel={false}
+ className="size-full"
+ />
+ </button>
+ </TooltipHint>
))}
</div>
)}
diff --git a/packages/views/issues/components/filter-chips-bar.tsx b/packages/views/issues/components/filter-chips-bar.tsx
index a396efd944..5f4a1dab24 100644
--- a/packages/views/issues/components/filter-chips-bar.tsx
+++ b/packages/views/issues/components/filter-chips-bar.tsx
@@ -17,6 +17,7 @@ import {
} from "lucide-react";
import { useQuery } from "@tanstack/react-query";
import { Button } from "@multica/ui/components/ui/button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useWorkspaceId } from "@multica/core/hooks";
import { memberListOptions, agentListOptions, squadListOptions } from "@multica/core/workspace/queries";
import { projectListOptions } from "@multica/core/projects/queries";
@@ -594,6 +595,7 @@ function useFilterChips(
function ChipSpan({ chip }: { chip: FilterChip }) {
const { t } = useT("issues");
+ const removeLabel = t(($) => $.filters.chip_remove, { name: chip.label });
return (
// Keyed per dimension: the chip animates in once when its dimension
// first gains a value; value changes inside it re-render without
@@ -608,14 +610,16 @@ function ChipSpan({ chip }: { chip: FilterChip }) {
{chip.valueIcons}
<span className="truncate font-medium">{chip.value}</span>
</span>
- <button
- type="button"
- aria-label={t(($) => $.filters.chip_remove, { name: chip.label })}
- onClick={chip.onRemove}
- className="flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground"
- >
- <X className="size-3" />
- </button>
+ <TooltipHint label={removeLabel}>
+ <button
+ type="button"
+ aria-label={removeLabel}
+ onClick={chip.onRemove}
+ className="flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground"
+ >
+ <X className="size-3" />
+ </button>
+ </TooltipHint>
</span>
);
}
diff --git a/packages/views/issues/components/find-bar.tsx b/packages/views/issues/components/find-bar.tsx
index 2c218ea00e..f3ab7a263f 100644
--- a/packages/views/issues/components/find-bar.tsx
+++ b/packages/views/issues/components/find-bar.tsx
@@ -3,7 +3,7 @@
import type { KeyboardEvent } from "react";
import { ChevronDown, ChevronUp, Search, X } from "lucide-react";
import { Input } from "@multica/ui/components/ui/input";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../../i18n";
import type { UseInPageFindResult } from "../hooks/use-in-page-find";
@@ -78,38 +78,38 @@ export function FindBar({
{countLabel}
</span>
<div className="flex items-center">
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
disabled={noMatches}
onClick={goPrev}
- aria-label={t(($) => $.detail.find.previous)}
- title={t(($) => $.detail.find.previous)}
+ label={t(($) => $.detail.find.previous)}
+ tooltipSide="bottom"
>
<ChevronUp />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
disabled={noMatches}
onClick={goNext}
- aria-label={t(($) => $.detail.find.next)}
- title={t(($) => $.detail.find.next)}
+ label={t(($) => $.detail.find.next)}
+ tooltipSide="bottom"
>
<ChevronDown />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
onClick={closeFind}
- aria-label={t(($) => $.detail.find.close)}
- title={t(($) => $.detail.find.close)}
+ label={t(($) => $.detail.find.close)}
+ tooltipSide="bottom"
>
<X />
- </Button>
+ </IconButton>
</div>
</div>
);
diff --git a/packages/views/issues/components/hidden-columns-panel.tsx b/packages/views/issues/components/hidden-columns-panel.tsx
index d531bc5c3f..5f6d8ebcfe 100644
--- a/packages/views/issues/components/hidden-columns-panel.tsx
+++ b/packages/views/issues/components/hidden-columns-panel.tsx
@@ -2,7 +2,7 @@
import { Eye, Filter, MoreHorizontal } from "lucide-react";
import type { IssueStatus } from "@multica/core/types";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuTrigger,
@@ -111,15 +111,15 @@ export function HiddenColumnRow({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.board.show_column)}
+ label={t(($) => $.board.show_column)}
className="rounded-full text-muted-foreground"
>
<MoreHorizontal className="size-3.5" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end">
diff --git a/packages/views/issues/components/inline-comment-run.tsx b/packages/views/issues/components/inline-comment-run.tsx
index 84ce8f6fa5..e223adfd8e 100644
--- a/packages/views/issues/components/inline-comment-run.tsx
+++ b/packages/views/issues/components/inline-comment-run.tsx
@@ -15,6 +15,7 @@ import { dispatchReasonCode } from "@multica/core/api";
import type { AgentTask, TimelineEntry } from "@multica/core/types";
import { ActorAvatar } from "../../common/actor-avatar";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import { cn } from "@multica/ui/lib/utils";
import { AgentTranscriptDialog, StepBody } from "../../common/task-transcript/agent-transcript-dialog";
@@ -148,11 +149,11 @@ export function InlineCommentRun({ run, className, viewState, showIdentity = fal
: isError ? <div role="alert" className="text-body text-destructive">{t(($) => $.inline_run.load_failed)}
<button className="ml-2 underline" type="button" onClick={() => void refetch()}>{t(($) => $.inline_run.try_again)}</button>
</div> : undefined} />;
- const stopButton = active && <Button size="icon-sm" variant="ghost" className="text-muted-foreground"
- aria-label={stopLabel} title={stopLabel} disabled={cancel.isPending || cancel.isSuccess}
+ const stopButton = active && <IconButton size="icon-sm" variant="ghost" className="text-muted-foreground"
+ label={stopLabel} disabled={cancel.isPending || cancel.isSuccess}
onClick={() => setConfirmStop(true)}>
{cancel.isPending || cancel.isSuccess ? <Loader2 className="size-3.5 animate-spin motion-reduce:animate-none" /> : <Square className="size-3.5" />}
- </Button>;
+ </IconButton>;
const stopDialog = <TerminateTaskConfirmDialog open={confirmStop} onOpenChange={setConfirmStop}
showRunningNote={task.status !== "queued"}
onConfirm={() => cancel.mutate(task.id, { onError: () => toast.error(t(($) => $.execution_log.cancel_failed)) })} />;
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 9df9ba74ae..74b5a3c5cd 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -37,6 +37,8 @@ import {
import { BreadcrumbHeader, type BreadcrumbSegment } from "../../layout/breadcrumb-header";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@multica/ui/components/ui/resizable";
import { Sheet, SheetContent } from "@multica/ui/components/ui/sheet";
import { useIsMobile } from "@multica/ui/hooks/use-mobile";
@@ -67,6 +69,7 @@ import { Checkbox } from "@multica/ui/components/ui/checkbox";
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@multica/ui/components/ui/command";
import { AvatarGroup, AvatarGroupCount } from "@multica/ui/components/ui/avatar";
import { ActorAvatar } from "../../common/actor-avatar";
+import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";
import { PropRow } from "../../common/prop-row";
import { TimelineHandoff } from "../../workflows/timeline-handoff";
import { PropertyIcon } from "../../common/property-icon";
@@ -1289,6 +1292,7 @@ export function IssueDetailSkeleton({
export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = true, layoutId = "multica_issue_detail_layout", highlightCommentId, highlightRequestToken, leadingAction, variant = "page", trailingActions }: IssueDetailProps) {
const isPeek = variant === "peek";
const { t } = useT("issues");
+ const { t: tCommon } = useT("common");
const locale = useLocale();
const timeAgo = useTimeAgo();
const id = issueId;
@@ -2893,15 +2897,16 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
<span className="text-muted-foreground shrink-0">{parentIssue.identifier}</span>
<span className="truncate group-hover:text-foreground">{parentIssue.title}</span>
</AppLink>
- <button
- type="button"
- title={t(($) => $.actions.remove_parent_issue)}
- aria-label={t(($) => $.actions.remove_parent_issue)}
- onClick={() => actions.removeParent()}
- className="shrink-0 rounded-xs p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"
- >
- <Unlink className="h-3.5 w-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.actions.remove_parent_issue)}>
+ <button
+ type="button"
+ aria-label={t(($) => $.actions.remove_parent_issue)}
+ onClick={() => actions.removeParent()}
+ className="shrink-0 rounded-xs p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"
+ >
+ <Unlink className="h-3.5 w-3.5" />
+ </button>
+ </TooltipHint>
</div>
</div>}
</div>
@@ -3210,29 +3215,28 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
// to the list we came from, falling back to all issues.
onDeletedFallbackPath={onDelete ? undefined : paths.issues()}
trigger={
- <Button variant="ghost" size="icon-sm" className="text-muted-foreground">
+ <IconButton
+ label={tCommon(($) => $.more_actions)}
+ tooltipSide="bottom"
+ className="text-muted-foreground"
+ >
<MoreHorizontal />
- </Button>
+ </IconButton>
}
/>
{isPeek ? (
trailingActions
) : (
- <Tooltip>
- <TooltipTrigger
- render={
- <Button
- variant={sidebarOpen ? "secondary" : "ghost"}
- size="icon-sm"
- className={sidebarOpen ? "" : "text-muted-foreground"}
- onClick={handleToggleSidebar}
- >
- <PanelRight />
- </Button>
- }
- />
- <TooltipContent side="bottom">{t(($) => $.detail.sidebar_tooltip)}</TooltipContent>
- </Tooltip>
+ <IconButton
+ label={t(($) => $.detail.sidebar_tooltip)}
+ shortcut={<ActionShortcutKeycaps action="toggleRightSidebar" />}
+ tooltipSide="bottom"
+ variant={sidebarOpen ? "secondary" : "ghost"}
+ className={sidebarOpen ? "" : "text-muted-foreground"}
+ onClick={handleToggleSidebar}
+ >
+ <PanelRight />
+ </IconButton>
)}
</>
}
diff --git a/packages/views/issues/components/issue-runs-dialog.tsx b/packages/views/issues/components/issue-runs-dialog.tsx
index 35c76d6243..7383a2f5cd 100644
--- a/packages/views/issues/components/issue-runs-dialog.tsx
+++ b/packages/views/issues/components/issue-runs-dialog.tsx
@@ -14,6 +14,7 @@ import {
import { useActorName } from "@multica/core/workspace/hooks";
import { useCustomPricingStore } from "@multica/core/runtimes/custom-pricing-store";
import { ActorAvatar } from "../../common/actor-avatar";
+import { DeferredTooltip } from "../../common/deferred-tooltip";
import { TranscriptButton } from "../../common/task-transcript";
import { cancellationActorLabel, cancelReasonLabel, failureReasonLabel } from "../../agents/components/tabs/task-failure";
import { Segmented } from "../../dashboard/components/dashboard-shared";
@@ -930,16 +931,21 @@ function RunListRow({ run, issueId }: { run: TimelineRun; issueId: string }) {
{canRetryRun(task) && <RetryRunButton task={task} issueId={issueId} />}
</span>
<span className={cn(COL.toggle, "flex justify-end")}>
- <button
- type="button"
- aria-expanded={expanded}
- aria-controls={detailsId}
- aria-label={t(($) => $.runs_timeline.details_toggle)}
- onClick={() => setExpanded((v) => !v)}
- className="flex size-6 items-center justify-center rounded-xs text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50"
- >
- <ChevronRight aria-hidden className={cn("size-3.5 transition-transform", expanded && "rotate-90")} />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.runs_timeline.details_toggle)}
+ trigger={
+ <button
+ type="button"
+ aria-expanded={expanded}
+ aria-controls={detailsId}
+ aria-label={t(($) => $.runs_timeline.details_toggle)}
+ onClick={() => setExpanded((v) => !v)}
+ className="flex size-6 items-center justify-center rounded-xs text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50"
+ >
+ <ChevronRight aria-hidden className={cn("size-3.5 transition-transform", expanded && "rotate-90")} />
+ </button>
+ }
+ />
</span>
</div>
{expanded && <RunDetails id={detailsId} run={run} reason={reason} />}
diff --git a/packages/views/issues/components/issues-header.tsx b/packages/views/issues/components/issues-header.tsx
index f7123e1f10..3f4de32665 100644
--- a/packages/views/issues/components/issues-header.tsx
+++ b/packages/views/issues/components/issues-header.tsx
@@ -2322,7 +2322,6 @@ export function IssueDisplayControls({
act.setSortDirection(sortDirection === "asc" ? "desc" : "asc")
}
aria-label={sortDirectionLabel}
- title={sortDirectionLabel}
>
{sortDirectionLabel}
</Button>
diff --git a/packages/views/issues/components/manage-views-dialog.tsx b/packages/views/issues/components/manage-views-dialog.tsx
index 4dd016436a..c6ba532eba 100644
--- a/packages/views/issues/components/manage-views-dialog.tsx
+++ b/packages/views/issues/components/manage-views-dialog.tsx
@@ -18,7 +18,8 @@ import {
import { CSS } from "@dnd-kit/utilities";
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
import { GripVertical, Layers, Pencil, Trash2 } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Switch } from "@multica/ui/components/ui/switch";
import {
Dialog,
@@ -73,18 +74,20 @@ function SortableRow({
isDragging && "z-10 bg-accent opacity-80",
)}
>
- <button
- type="button"
- {...attributes}
- {...listeners}
- aria-label={t(($) => $.view_bar.drag_handle)}
- className={cn(
- "cursor-grab active:cursor-grabbing text-faint-foreground hover:text-muted-foreground",
- isDragging && "cursor-grabbing",
- )}
- >
- <GripVertical className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.view_bar.drag_handle)}>
+ <button
+ type="button"
+ {...attributes}
+ {...listeners}
+ aria-label={t(($) => $.view_bar.drag_handle)}
+ className={cn(
+ "cursor-grab active:cursor-grabbing text-faint-foreground hover:text-muted-foreground",
+ isDragging && "cursor-grabbing",
+ )}
+ >
+ <GripVertical className="size-3.5" />
+ </button>
+ </TooltipHint>
<span className="min-w-0 flex-1 truncate text-body">
{item.label}
{item.kind === "builtin" && (
@@ -95,23 +98,23 @@ function SortableRow({
</span>
{item.kind === "view" && item.canManage && (
<span className="flex items-center gap-0.5">
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.view_selector.edit)}
+ label={t(($) => $.view_selector.edit)}
onClick={onEdit}
>
<Pencil className="size-3.5" />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.view_bar.delete)}
+ label={t(($) => $.view_bar.delete)}
onClick={onDelete}
className="text-muted-foreground hover:text-destructive"
>
<Trash2 className="size-3.5" />
- </Button>
+ </IconButton>
</span>
)}
<Switch
diff --git a/packages/views/issues/components/pickers/assignee-picker.tsx b/packages/views/issues/components/pickers/assignee-picker.tsx
index d2babce4a7..8b9ee60443 100644
--- a/packages/views/issues/components/pickers/assignee-picker.tsx
+++ b/packages/views/issues/components/pickers/assignee-picker.tsx
@@ -53,6 +53,8 @@ interface AssigneePickerProps {
onUpdate: (updates: Partial<UpdateIssueRequest>) => void;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement<Record<string, unknown>>;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
open?: boolean;
onOpenChange?: (v: boolean) => void;
align?: "start" | "center" | "end";
@@ -81,6 +83,7 @@ export function AssigneePicker(props: AssigneePickerProps) {
trigger={props.trigger}
triggerRender={props.triggerRender}
triggerClassName={PICKER_TRIGGER_CLASS}
+ tooltip={props.tooltip}
>
{(open, onOpenChange) => (
<AssigneePickerImpl {...props} open={open} onOpenChange={onOpenChange} />
@@ -96,6 +99,7 @@ function AssigneePickerImpl({
onUpdate,
trigger: customTrigger,
triggerRender,
+ tooltip,
open: controlledOpen,
onOpenChange: controlledOnOpenChange,
align,
@@ -164,6 +168,7 @@ function AssigneePickerImpl({
searchPlaceholder={t(($) => $.pickers.assignee.search_placeholder)}
onSearchChange={setFilter}
triggerRender={triggerRender}
+ tooltip={tooltip}
trigger={
customTrigger ? customTrigger : assigneeType && assigneeId ? (
<>
diff --git a/packages/views/issues/components/pickers/custom-property-picker.tsx b/packages/views/issues/components/pickers/custom-property-picker.tsx
index 792a2b0194..b4bedbe61a 100644
--- a/packages/views/issues/components/pickers/custom-property-picker.tsx
+++ b/packages/views/issues/components/pickers/custom-property-picker.tsx
@@ -20,7 +20,7 @@ import {
PopoverTrigger,
PopoverContent,
} from "@multica/ui/components/ui/popover";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { useLocale, useT } from "../../../i18n";
import { PropertyPicker, PickerItem } from "./property-picker";
@@ -468,15 +468,15 @@ function TextishPropertyEditor({
className="h-8"
/>
{property.type === "url" && typeof value === "string" && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.pickers.custom_property.open_link)}
+ label={t(($) => $.pickers.custom_property.open_link)}
onClick={() => window.open(value, "_blank", "noopener,noreferrer")}
>
<ExternalLink className="size-3.5" />
- </Button>
+ </IconButton>
)}
</form>
</PopoverContent>
@@ -574,26 +574,26 @@ function ListPropertyEditor({
<li key={item} className="flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-accent/40">
<span className="min-w-0 flex-1 truncate text-body">{item}</span>
{property.type === "multi_url" && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.pickers.custom_property.open_link)}
+ label={t(($) => $.pickers.custom_property.open_link)}
onClick={() => window.open(item, "_blank", "noopener,noreferrer")}
>
<ExternalLink className="size-3.5" />
- </Button>
+ </IconButton>
)}
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.pickers.custom_property.remove_item, { value: item })}
+ label={t(($) => $.pickers.custom_property.remove_item, { value: item })}
disabled={saving}
onClick={() => void save(items.filter((entry) => entry !== item))}
>
<X className="size-3.5" />
- </Button>
+ </IconButton>
</li>
))}
</ul>
diff --git a/packages/views/issues/components/pickers/due-date-picker.tsx b/packages/views/issues/components/pickers/due-date-picker.tsx
index 5c250661e1..bb07c9ddfa 100644
--- a/packages/views/issues/components/pickers/due-date-picker.tsx
+++ b/packages/views/issues/components/pickers/due-date-picker.tsx
@@ -10,6 +10,7 @@ export function DueDatePicker({
onUpdate,
trigger,
triggerRender,
+ tooltip,
open,
onOpenChange,
align = "start",
@@ -19,6 +20,8 @@ export function DueDatePicker({
onUpdate: (updates: Partial<UpdateIssueRequest>) => void;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement<Record<string, unknown>>;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
open?: boolean;
onOpenChange?: (v: boolean) => void;
align?: "start" | "center" | "end";
@@ -37,6 +40,7 @@ export function DueDatePicker({
highlightOverdue
trigger={trigger}
triggerRender={triggerRender}
+ tooltip={tooltip}
open={open}
onOpenChange={onOpenChange}
align={align}
diff --git a/packages/views/issues/components/pickers/label-picker.tsx b/packages/views/issues/components/pickers/label-picker.tsx
index ba1619c330..f7c3d519c6 100644
--- a/packages/views/issues/components/pickers/label-picker.tsx
+++ b/packages/views/issues/components/pickers/label-picker.tsx
@@ -47,6 +47,8 @@ interface LabelPickerProps {
* × affordance — a remove <button> can't nest inside a trigger <button>,
* so removal happens by toggling the label off in the open picker. */
triggerRender?: React.ReactElement;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
}
/**
@@ -96,6 +98,7 @@ export function LabelPicker({
align = "start",
defaultOpen = false,
triggerRender,
+ tooltip,
}: LabelPickerProps) {
const { t } = useT("issues");
const [internalOpen, setInternalOpen] = useState(defaultOpen);
@@ -226,6 +229,7 @@ export function LabelPicker({
searchPlaceholder={t(($) => $.pickers.label.search_placeholder)}
onSearchChange={setFilter}
triggerRender={resolvedTriggerRender}
+ tooltip={tooltip}
trigger={
hasLabels ? (
<>
diff --git a/packages/views/issues/components/pickers/priority-picker.tsx b/packages/views/issues/components/pickers/priority-picker.tsx
index b398b02855..1e8181b27a 100644
--- a/packages/views/issues/components/pickers/priority-picker.tsx
+++ b/packages/views/issues/components/pickers/priority-picker.tsx
@@ -19,6 +19,8 @@ interface PriorityPickerProps {
onUpdate: (updates: Partial<UpdateIssueRequest>) => void;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement<Record<string, unknown>>;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
open?: boolean;
onOpenChange?: (v: boolean) => void;
align?: "start" | "center" | "end";
@@ -48,6 +50,7 @@ export function PriorityPicker(props: PriorityPickerProps) {
trigger={props.trigger}
triggerRender={props.triggerRender}
triggerClassName={PICKER_TRIGGER_CLASS}
+ tooltip={props.tooltip}
>
{(open, onOpenChange) => (
<PriorityPickerImpl {...props} open={open} onOpenChange={onOpenChange} />
@@ -61,6 +64,7 @@ function PriorityPickerImpl({
onUpdate,
trigger: customTrigger,
triggerRender,
+ tooltip,
open: controlledOpen,
onOpenChange: controlledOnOpenChange,
align,
@@ -78,6 +82,7 @@ function PriorityPickerImpl({
width="w-44"
align={align}
triggerRender={triggerRender}
+ tooltip={tooltip}
trigger={
customTrigger ??
(priority != null ? (
diff --git a/packages/views/issues/components/pickers/stage-picker.tsx b/packages/views/issues/components/pickers/stage-picker.tsx
index e4f91e6bde..49f3bc4d4b 100644
--- a/packages/views/issues/components/pickers/stage-picker.tsx
+++ b/packages/views/issues/components/pickers/stage-picker.tsx
@@ -31,6 +31,7 @@ export function StagePicker({
maxStage = 0,
trigger: customTrigger,
triggerRender,
+ tooltip,
open: controlledOpen,
onOpenChange: controlledOnOpenChange,
align,
@@ -42,6 +43,8 @@ export function StagePicker({
maxStage?: number;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
open?: boolean;
onOpenChange?: (v: boolean) => void;
align?: "start" | "center" | "end";
@@ -62,6 +65,7 @@ export function StagePicker({
width="w-44"
align={align}
triggerRender={triggerRender}
+ tooltip={tooltip}
trigger={
customTrigger ?? (
<>
diff --git a/packages/views/issues/components/pickers/start-date-picker.tsx b/packages/views/issues/components/pickers/start-date-picker.tsx
index 4c911f6e53..77ddd9d876 100644
--- a/packages/views/issues/components/pickers/start-date-picker.tsx
+++ b/packages/views/issues/components/pickers/start-date-picker.tsx
@@ -10,6 +10,7 @@ export function StartDatePicker({
onUpdate,
trigger,
triggerRender,
+ tooltip,
open,
onOpenChange,
align = "start",
@@ -19,6 +20,8 @@ export function StartDatePicker({
onUpdate: (updates: Partial<UpdateIssueRequest>) => void;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement<Record<string, unknown>>;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
open?: boolean;
onOpenChange?: (v: boolean) => void;
align?: "start" | "center" | "end";
@@ -36,6 +39,7 @@ export function StartDatePicker({
emptyLabel={t(($) => $.pickers.start_date.none)}
trigger={trigger}
triggerRender={triggerRender}
+ tooltip={tooltip}
open={open}
onOpenChange={onOpenChange}
align={align}
diff --git a/packages/views/issues/components/pickers/status-picker.test.tsx b/packages/views/issues/components/pickers/status-picker.test.tsx
index 18817dffa7..55b841e156 100644
--- a/packages/views/issues/components/pickers/status-picker.test.tsx
+++ b/packages/views/issues/components/pickers/status-picker.test.tsx
@@ -242,6 +242,7 @@ describe("StatusPicker on an issue outside any project (MUL-8121)", () => {
name: "Default",
description: "",
is_default: true,
+ owner_id: null,
steps: [
{ status_key: "todo", handler: { type: "none" }, instructions: "" },
// A handoff on Default never fires outside a project, so it is not hinted.
diff --git a/packages/views/issues/components/pickers/status-picker.tsx b/packages/views/issues/components/pickers/status-picker.tsx
index 80c1b0123c..d32ef2dc2f 100644
--- a/packages/views/issues/components/pickers/status-picker.tsx
+++ b/packages/views/issues/components/pickers/status-picker.tsx
@@ -25,6 +25,7 @@ export function StatusPicker({
onUpdate,
trigger: customTrigger,
triggerRender,
+ tooltip,
open: controlledOpen,
onOpenChange: controlledOnOpenChange,
align,
@@ -44,6 +45,8 @@ export function StatusPicker({
onUpdate: (updates: Partial<UpdateIssueRequest>) => void;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
open?: boolean;
onOpenChange?: (v: boolean) => void;
align?: "start" | "center" | "end";
@@ -145,6 +148,7 @@ export function StatusPicker({
width={workflow || defaultScope ? "w-60" : "w-52"}
align={align}
triggerRender={triggerRender}
+ tooltip={tooltip}
searchable={searchable}
searchPlaceholder={t(($) => $.filters.search_status)}
onSearchChange={setQuery}
diff --git a/packages/views/issues/components/pull-request-list.tsx b/packages/views/issues/components/pull-request-list.tsx
index 8b9daa3cf1..8fe1699c47 100644
--- a/packages/views/issues/components/pull-request-list.tsx
+++ b/packages/views/issues/components/pull-request-list.tsx
@@ -38,7 +38,7 @@ import type {
GitHubPullRequestState,
PRAutoComplete,
} from "@multica/core/types";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip";
import {
DropdownMenu,
@@ -211,14 +211,14 @@ function PullRequestRowMenu({ pr, actions }: { pr: GitHubPullRequest; actions: R
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-xs"
- aria-label={t(($) => $.pr_automation.row_menu)}
+ label={t(($) => $.pr_automation.row_menu)}
className="absolute top-0.5 right-0 opacity-0 group-hover/pr:opacity-100 group-focus-within/pr:opacity-100 data-popup-open:opacity-100 [@media(pointer:coarse)]:opacity-100"
>
<MoreHorizontal />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end" className="w-56">
diff --git a/packages/views/issues/components/pull-requests-section.tsx b/packages/views/issues/components/pull-requests-section.tsx
index 6d7ae265d1..f41b7fb6fc 100644
--- a/packages/views/issues/components/pull-requests-section.tsx
+++ b/packages/views/issues/components/pull-requests-section.tsx
@@ -13,6 +13,7 @@ import {
} from "@multica/core/github";
import { useWorkspacePaths } from "@multica/core/paths";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuContent,
@@ -121,9 +122,9 @@ function LinkPullRequestPopover({
>
<PopoverTrigger
render={
- <Button variant="ghost" size="icon-xs" aria-label={t(($) => $.pr_automation.link_action)}>
+ <IconButton variant="ghost" size="icon-xs" label={t(($) => $.pr_automation.link_action)}>
<Plus />
- </Button>
+ </IconButton>
}
/>
<PopoverContent align="end" className="w-80">
@@ -210,9 +211,9 @@ function AutoCompleteMenu({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button variant="ghost" size="icon-xs" aria-label={t(($) => $.pr_automation.section_menu)}>
+ <IconButton variant="ghost" size="icon-xs" label={t(($) => $.pr_automation.section_menu)}>
<MoreHorizontal />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end" className="w-60">
diff --git a/packages/views/issues/components/reply-annotations.tsx b/packages/views/issues/components/reply-annotations.tsx
index b033ba3988..f2b513a093 100644
--- a/packages/views/issues/components/reply-annotations.tsx
+++ b/packages/views/issues/components/reply-annotations.tsx
@@ -3,6 +3,7 @@
import { useRef, useState } from "react";
import { MessageSquare, X } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";
import { useCommentDraftStore, type CommentDraftKey } from "@multica/core/issues/stores";
import type { ReplyAnnotation } from "@multica/core/drafts/reply-annotation";
@@ -57,9 +58,9 @@ export function ReplyAnnotations({ draftKey, annotations, disabled, onEditAnnota
{t(($) => $.reply.annotations.source_changed)}
</p>}
</div>
- <Button variant="ghost" size="icon-sm" disabled={disabled}
- aria-label={t(($) => $.reply.annotations.remove, { number: index + 1 })}
- onClick={() => useCommentDraftStore.getState().removeAnnotation(draftKey, annotation.id)}><X /></Button>
+ <IconButton variant="ghost" size="icon-sm" disabled={disabled}
+ label={t(($) => $.reply.annotations.remove, { number: index + 1 })}
+ onClick={() => useCommentDraftStore.getState().removeAnnotation(draftKey, annotation.id)}><X /></IconButton>
</div>)}
</div>
</PopoverContent>
diff --git a/packages/views/issues/components/reply-input.tsx b/packages/views/issues/components/reply-input.tsx
index 20292cf8e4..6a3ab756a4 100644
--- a/packages/views/issues/components/reply-input.tsx
+++ b/packages/views/issues/components/reply-input.tsx
@@ -9,7 +9,8 @@ import { SubmitButton } from "@multica/ui/components/common/submit-button";
import { Button } from "@multica/ui/components/ui/button";
import { ActorAvatar } from "../../common/actor-avatar";
import { contentReferencesAttachment, type AgentTask } from "@multica/core/types";
-import { formatShortcut, useShortcut } from "@multica/core/shortcuts";
+import { useShortcut } from "@multica/core/shortcuts";
+import { ShortcutKeycaps } from "../../common/shortcut-keycaps";
import { useCommentDraftStore, type CommentDraftKey } from "@multica/core/issues/stores";
import { cn } from "@multica/ui/lib/utils";
import type { AvatarSize } from "@multica/ui/lib/avatar-size";
@@ -334,13 +335,19 @@ function ReplyInput({
disabled={!canSend}
loading={submitting}
busy={gate.uploading}
- tooltip={gate.uploading
+ disabledReason={gate.uploading
? tEditor(($) => $.upload.in_progress)
: !canSend && annotations.length > 0 && !targetMissing
? t(($) => $.reply.annotations.intent_hint)
- : sendShortcut
- ? `${t(($) => $.comment.send_tooltip)} · ${formatShortcut(sendShortcut)}`
- : t(($) => $.comment.send_tooltip)}
+ : undefined}
+ tooltip={sendShortcut
+ ? (
+ <>
+ {t(($) => $.comment.send_tooltip)}
+ <ShortcutKeycaps shortcut={sendShortcut} decorative />
+ </>
+ )
+ : t(($) => $.comment.send_tooltip)}
ariaLabel={gate.uploading
? tEditor(($) => $.upload.in_progress)
: t(($) => $.comment.send_tooltip)}
diff --git a/packages/views/issues/components/save-view-dialog.tsx b/packages/views/issues/components/save-view-dialog.tsx
index 89a55981d6..c96aee618d 100644
--- a/packages/views/issues/components/save-view-dialog.tsx
+++ b/packages/views/issues/components/save-view-dialog.tsx
@@ -395,7 +395,6 @@ export function DraftDefinitionFields() {
)
}
aria-label={sortDirectionLabel ?? undefined}
- title={sortDirectionLabel ?? undefined}
>
{sortDirectionLabel}
</Button>
diff --git a/packages/views/issues/components/source-context-viewer.tsx b/packages/views/issues/components/source-context-viewer.tsx
index 834f2b3b55..80d9d5cff0 100644
--- a/packages/views/issues/components/source-context-viewer.tsx
+++ b/packages/views/issues/components/source-context-viewer.tsx
@@ -7,6 +7,7 @@ import { useWorkspaceId } from "@multica/core/hooks";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import type { Issue, IssueSourceContext, SourceContextCommentSnapshot } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@multica/ui/components/ui/dialog";
import { cn } from "@multica/ui/lib/utils";
import { useWorkspacePaths } from "@multica/core/paths";
@@ -223,32 +224,30 @@ export function SourceContextBadge({
}).format(new Date(current.captured_at))}
</DialogDescription>
<div className="absolute right-3 top-3 flex items-center gap-1">
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => viewerExpanded
- ? $.source_context.viewer_restore
- : $.source_context.viewer_expand)}
- title={t(($) => viewerExpanded
+ label={t(($) => viewerExpanded
? $.source_context.viewer_restore
: $.source_context.viewer_expand)}
+ tooltipSide="bottom"
aria-pressed={viewerExpanded}
onClick={() => setViewerExpanded((value) => !value)}
>
{viewerExpanded
? <Minimize2 className="size-4" aria-hidden />
: <Maximize2 className="size-4" aria-hidden />}
- </Button>
+ </IconButton>
{current.anchor_comment_state === "available"
&& current.can_open_current_source === true
&& current.current_source && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.source_context.open_current)}
- title={t(($) => $.source_context.open_current)}
+ label={t(($) => $.source_context.open_current)}
+ tooltipSide="bottom"
onClick={() => {
void refresh().then((fresh) => {
if (fresh) openCurrent(fresh);
@@ -256,18 +255,18 @@ export function SourceContextBadge({
}}
>
<LocateFixed className="size-4" aria-hidden />
- </Button>
+ </IconButton>
)}
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.source_context.viewer_close)}
- title={t(($) => $.source_context.viewer_close)}
+ label={t(($) => $.source_context.viewer_close)}
+ tooltipSide="bottom"
onClick={() => setViewerOpen(false)}
>
<XIcon className="size-4" aria-hidden />
- </Button>
+ </IconButton>
</div>
</DialogHeader>
<div className="min-h-0 flex-1 space-y-5 overflow-y-auto overscroll-contain px-5 py-5 sm:px-6">
@@ -300,15 +299,12 @@ export function SourceContextBadge({
{t(($) => $.source_context.label_spacing)}
{issueAttachmentSummary}
{recognizedIssueAttachmentChangeCount > 0 && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
className="-my-1 ml-1 size-6 align-middle text-muted-foreground hover:text-foreground"
- aria-label={t(($) => issueAttachmentDetailsOpen
- ? $.source_context.hide_issue_attachment_details
- : $.source_context.show_issue_attachment_details)}
- title={t(($) => issueAttachmentDetailsOpen
+ label={t(($) => issueAttachmentDetailsOpen
? $.source_context.hide_issue_attachment_details
: $.source_context.show_issue_attachment_details)}
aria-expanded={issueAttachmentDetailsOpen}
@@ -321,7 +317,7 @@ export function SourceContextBadge({
)}
aria-hidden
/>
- </Button>
+ </IconButton>
)}
</p>
)}
diff --git a/packages/views/issues/components/swimlane-view.tsx b/packages/views/issues/components/swimlane-view.tsx
index b7960edf05..150c8dd4b7 100644
--- a/packages/views/issues/components/swimlane-view.tsx
+++ b/packages/views/issues/components/swimlane-view.tsx
@@ -1463,6 +1463,7 @@ function SwimLaneViewImpl({
DeferredPopup. */}
<DeferredPopup
ariaHasPopup="menu"
+ tooltip={t(($) => $.board.hide_column)}
triggerRender={
<Button
type="button"
@@ -1477,17 +1478,22 @@ function SwimLaneViewImpl({
>
{(open, onOpenChange) => (
<DropdownMenu open={open} onOpenChange={onOpenChange}>
- <DropdownMenuTrigger
- render={
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- aria-label={t(($) => $.board.hide_column)}
- className="rounded-full text-muted-foreground"
- >
- <MoreHorizontal className="size-3.5" />
- </Button>
+ <DeferredTooltip
+ content={t(($) => $.board.hide_column)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t(($) => $.board.hide_column)}
+ className="rounded-full text-muted-foreground"
+ >
+ <MoreHorizontal className="size-3.5" />
+ </Button>
+ }
+ />
}
/>
<DropdownMenuContent align="end">
diff --git a/packages/views/issues/components/system-wakeup-row.tsx b/packages/views/issues/components/system-wakeup-row.tsx
index 36078ddd43..f21e1ad984 100644
--- a/packages/views/issues/components/system-wakeup-row.tsx
+++ b/packages/views/issues/components/system-wakeup-row.tsx
@@ -6,6 +6,7 @@ import { toast } from "sonner";
import { useUpdateIssueSystemWakeup } from "@multica/core/issues";
import type { SystemWakeup } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Switch } from "@multica/ui/components/ui/switch";
import { Textarea } from "@multica/ui/components/ui/textarea";
import {
@@ -163,11 +164,11 @@ function InstructionEditor({
<div>
<div className="flex items-center justify-between gap-2">
<p className="text-caption font-medium">{label}</p>
- <Button
+ <IconButton
variant="ghost"
size="icon-xs"
className="text-muted-foreground"
- aria-label={t(($) => $.wakeups.system.instruction_edit)}
+ label={t(($) => $.wakeups.system.instruction_edit)}
onClick={() => {
setValue(rule.instruction);
setError("");
@@ -175,7 +176,7 @@ function InstructionEditor({
}}
>
<Pencil aria-hidden="true" />
- </Button>
+ </IconButton>
</div>
{rule.instruction ? (
<p className="whitespace-pre-wrap break-words text-caption">{rule.instruction}</p>
diff --git a/packages/views/issues/components/table-view.tsx b/packages/views/issues/components/table-view.tsx
index 9d76ca59c4..4718dfe53b 100644
--- a/packages/views/issues/components/table-view.tsx
+++ b/packages/views/issues/components/table-view.tsx
@@ -54,6 +54,8 @@ import {
import { toast } from "sonner";
import { DataTable } from "@multica/ui/components/ui/data-table";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Input } from "@multica/ui/components/ui/input";
import {
DropdownMenu,
@@ -122,6 +124,7 @@ import {
} from "@tanstack/react-query";
import { runConfirmIntent } from "../actions/run-confirm-gate";
import { ActorAvatar } from "../../common/actor-avatar";
+import { DeferredTooltip } from "../../common/deferred-tooltip";
import { LabelChip } from "../../labels/label-chip";
import { resolveClickIntent, useIntentNavigate } from "../../navigation";
import { ProjectPicker } from "../../projects/components/project-picker";
@@ -451,18 +454,20 @@ function SortableColumnHeader({
)}
>
{sortable && (
- <button
- type="button"
- aria-label={reorderLabel}
- className={cn(
- "-ml-2 mr-0.5 rounded-xs p-0.5 text-muted-foreground opacity-0 hover:bg-accent hover:text-muted-foreground group-hover/header:opacity-100 focus-visible:opacity-100",
- isDragging ? "cursor-grabbing opacity-100" : "cursor-grab",
- )}
- {...attributes}
- {...listeners}
- >
- <GripVertical className="size-3" />
- </button>
+ <TooltipHint label={reorderLabel}>
+ <button
+ type="button"
+ aria-label={reorderLabel}
+ className={cn(
+ "-ml-2 mr-0.5 rounded-xs p-0.5 text-muted-foreground opacity-0 hover:bg-accent hover:text-muted-foreground group-hover/header:opacity-100 focus-visible:opacity-100",
+ isDragging ? "cursor-grabbing opacity-100" : "cursor-grab",
+ )}
+ {...attributes}
+ {...listeners}
+ >
+ <GripVertical className="size-3" />
+ </button>
+ </TooltipHint>
)}
<DropdownMenu>
<DropdownMenuTrigger className="flex min-w-0 items-center gap-1 rounded-xs px-1.5 py-1 hover:bg-accent">
@@ -503,9 +508,12 @@ function SortableColumnHeader({
export function TableColumnPicker({
properties,
trigger,
+ tooltip,
}: {
properties: IssueProperty[];
trigger: React.ReactElement;
+ /** Names an icon-only `trigger`. */
+ tooltip?: string;
}) {
const { t } = useT("issues");
const [search, setSearch] = useState("");
@@ -525,9 +533,11 @@ export function TableColumnPicker({
property.name.toLocaleLowerCase().includes(query),
);
+ const menuTrigger = <DropdownMenuTrigger render={trigger} />;
+
return (
<DropdownMenu>
- <DropdownMenuTrigger render={trigger} />
+ {tooltip ? <TooltipHint label={tooltip}>{menuTrigger}</TooltipHint> : menuTrigger}
<DropdownMenuContent align="end" className="w-64 p-0">
<div className="border-b p-2">
<Input
@@ -619,16 +629,17 @@ export function TableIssueSearch({
className="h-7 pl-7 pr-7 text-caption"
/>
{value && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
- aria-label={clearLabel}
+ label={clearLabel}
+ tooltipSide="bottom"
onClick={() => onChange("")}
className="absolute right-0.5 top-0.5 text-muted-foreground"
>
<X className="size-3" />
- </Button>
+ </IconButton>
)}
</div>
);
@@ -708,22 +719,27 @@ export function InlineTitle({
}}
>
{row.hasChildren ? (
- <button
- type="button"
- aria-label={toggleLabel}
- className="rounded-xs p-0.5 text-muted-foreground hover:bg-accent"
- onClick={(event) => {
- event.stopPropagation();
- onToggleParent();
- }}
- onAuxClick={stopRowNavigation}
- >
- {row.collapsed ? (
- <ChevronRight className="size-3.5" />
- ) : (
- <ChevronDown className="size-3.5" />
- )}
- </button>
+ <DeferredTooltip
+ content={toggleLabel}
+ trigger={
+ <button
+ type="button"
+ aria-label={toggleLabel}
+ className="rounded-xs p-0.5 text-muted-foreground hover:bg-accent"
+ onClick={(event) => {
+ event.stopPropagation();
+ onToggleParent();
+ }}
+ onAuxClick={stopRowNavigation}
+ >
+ {row.collapsed ? (
+ <ChevronRight className="size-3.5" />
+ ) : (
+ <ChevronDown className="size-3.5" />
+ )}
+ </button>
+ }
+ />
) : (
<span className="w-4 shrink-0" />
)}
@@ -777,31 +793,41 @@ export function InlineTitle({
* follows the row's hover colour, since that is what the cell is
* painted with when they appear. */}
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center gap-0.5 bg-gradient-to-l from-background from-70% to-transparent pr-1 pl-8 opacity-0 transition-opacity group-hover:from-[color-mix(in_oklab,var(--muted)_50%,var(--background))] group-hover/title:pointer-events-auto group-hover/title:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100">
- <button
- type="button"
- aria-label={createSubIssueLabel}
- className="rounded-xs p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
- onClick={(event) => {
- event.stopPropagation();
- onCreateSubIssue();
- }}
- onAuxClick={stopRowNavigation}
- >
- <Plus className="size-3" />
- </button>
- <button
- type="button"
- aria-label={renameLabel}
- className="rounded-xs p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
- onClick={(event) => {
- event.stopPropagation();
- setDraft(row.issue.title);
- onEditingChange(true);
- }}
- onAuxClick={stopRowNavigation}
- >
- <Pencil className="size-3" />
- </button>
+ <DeferredTooltip
+ content={createSubIssueLabel}
+ trigger={
+ <button
+ type="button"
+ aria-label={createSubIssueLabel}
+ className="rounded-xs p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
+ onClick={(event) => {
+ event.stopPropagation();
+ onCreateSubIssue();
+ }}
+ onAuxClick={stopRowNavigation}
+ >
+ <Plus className="size-3" />
+ </button>
+ }
+ />
+ <DeferredTooltip
+ content={renameLabel}
+ trigger={
+ <button
+ type="button"
+ aria-label={renameLabel}
+ className="rounded-xs p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
+ onClick={(event) => {
+ event.stopPropagation();
+ setDraft(row.issue.title);
+ onEditingChange(true);
+ }}
+ onAuxClick={stopRowNavigation}
+ >
+ <Pencil className="size-3" />
+ </button>
+ }
+ />
</span>
</>
)}
@@ -1051,6 +1077,7 @@ function IssueTableAddColumnHeader({
return (
<TableColumnPicker
properties={meta.properties}
+ tooltip={t(($) => $.table.columns.add)}
trigger={
<button
type="button"
diff --git a/packages/views/issues/components/use-comment-annotations.tsx b/packages/views/issues/components/use-comment-annotations.tsx
index ad3861d073..84c805dc48 100644
--- a/packages/views/issues/components/use-comment-annotations.tsx
+++ b/packages/views/issues/components/use-comment-annotations.tsx
@@ -5,6 +5,7 @@ import { MessageSquarePlus, Trash2 } from "lucide-react";
import { toast } from "sonner";
import { isImeComposing } from "@multica/core/utils";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { useCommentDraftStore, type CommentDraftKey } from "@multica/core/issues/stores";
import { MAX_ANNOTATION_QUOTE_LENGTH, MAX_REPLY_ANNOTATIONS, type ReplyAnnotation } from "@multica/core/drafts/reply-annotation";
import { useT } from "../../i18n";
@@ -256,10 +257,10 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edi
if (index < 0) return null;
return <CommentSelectionBubble key={anchor.id} range={anchor.range} source={anchor.root} owner={draftKey}
markerRanges={markerRanges.get(anchor.root)}>
- <Button variant="brandSubtle" size="icon-sm" className="size-6 rounded-full text-caption tabular-nums aria-expanded:ring-2 aria-expanded:ring-brand"
+ <IconButton variant="brandSubtle" size="icon-sm" className="size-6 rounded-full text-caption tabular-nums aria-expanded:ring-2 aria-expanded:ring-brand"
aria-expanded={editingId === anchor.id}
- aria-label={t(($) => $.reply.annotations.edit, { number: index + 1 })}
- onClick={() => editAnnotation(anchor.id)}>{index + 1}</Button>
+ label={t(($) => $.reply.annotations.edit, { number: index + 1 })}
+ onClick={() => editAnnotation(anchor.id)}>{index + 1}</IconButton>
</CommentSelectionBubble>;
})}
{enabled && selection && <CommentSelectionBubble range={selection.range} source={selection.root} owner={draftKey} onPositioned={focusNote}>
@@ -281,15 +282,14 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edi
}
}} />
<div className="flex items-center justify-end gap-1 px-1 pb-1">
- {editingExisting && <Button variant="ghost" size="icon-sm" className="mr-auto text-muted-foreground hover:text-destructive"
- aria-label={t(($) => $.reply.annotations.remove, { number: annotations.findIndex((a) => a.id === editing.id) + 1 })}
- title={t(($) => $.reply.annotations.remove, { number: annotations.findIndex((a) => a.id === editing.id) + 1 })}
+ {editingExisting && <IconButton variant="ghost" size="icon-sm" className="mr-auto text-muted-foreground hover:text-destructive"
+ label={t(($) => $.reply.annotations.remove, { number: annotations.findIndex((a) => a.id === editing.id) + 1 })}
onClick={() => {
useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);
close(true);
- }}><Trash2 /></Button>}
+ }}><Trash2 /></IconButton>}
<Button size="sm" disabled={!editing.note.trim()}
- aria-label={confirmLabel} title={confirmLabel} aria-keyshortcuts="Enter"
+ aria-label={confirmLabel} aria-keyshortcuts="Enter"
onClick={confirmNote}>{confirmLabel}</Button>
</div>
</div> : <Button ref={actionRef} variant="ghost" size="sm"
diff --git a/packages/views/issues/components/view-bar-popover.tsx b/packages/views/issues/components/view-bar-popover.tsx
index c28136e1ac..112f1a07e2 100644
--- a/packages/views/issues/components/view-bar-popover.tsx
+++ b/packages/views/issues/components/view-bar-popover.tsx
@@ -25,7 +25,8 @@ import {
Trash2,
} from "lucide-react";
import { toast } from "sonner";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
AlertDialog,
AlertDialogAction,
@@ -142,18 +143,20 @@ function SortablePanelRow({
isDragging ? "z-10 bg-accent opacity-80" : "hover:bg-muted/60",
)}
>
- <button
- type="button"
- {...attributes}
- {...listeners}
- aria-label={t(($) => $.view_bar.drag_handle)}
- className={cn(
- "cursor-grab active:cursor-grabbing text-faint-foreground hover:text-muted-foreground",
- isDragging && "cursor-grabbing",
- )}
- >
- <GripVertical className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.view_bar.drag_handle)}>
+ <button
+ type="button"
+ {...attributes}
+ {...listeners}
+ aria-label={t(($) => $.view_bar.drag_handle)}
+ className={cn(
+ "cursor-grab active:cursor-grabbing text-faint-foreground hover:text-muted-foreground",
+ isDragging && "cursor-grabbing",
+ )}
+ >
+ <GripVertical className="size-3.5" />
+ </button>
+ </TooltipHint>
<button
type="button"
onClick={onSelect}
@@ -173,14 +176,14 @@ function SortablePanelRow({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.view_bar.row_menu)}
+ label={t(($) => $.view_bar.row_menu)}
className="text-muted-foreground"
>
<MoreHorizontal className="size-3.5" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end" className="w-44">
diff --git a/packages/views/issues/components/wakeup-create.tsx b/packages/views/issues/components/wakeup-create.tsx
index 6eba48f282..1b3cfa43a1 100644
--- a/packages/views/issues/components/wakeup-create.tsx
+++ b/packages/views/issues/components/wakeup-create.tsx
@@ -27,6 +27,7 @@ import { ApiError } from "@multica/core/api";
import { agentListOptions, memberListOptions, squadListOptions } from "@multica/core/workspace/queries";
import { shortcutMatchesEvent, useShortcut } from "@multica/core/shortcuts";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import {
@@ -102,11 +103,11 @@ export function WakeupCreate({
>
<PopoverTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-xs"
className="text-muted-foreground"
- aria-label={t(($) => $.wakeups.create.open)}
+ label={t(($) => $.wakeups.create.open)}
/>
}
>
diff --git a/packages/views/labels/label-chip.tsx b/packages/views/labels/label-chip.tsx
index 301d55cb54..9585548252 100644
--- a/packages/views/labels/label-chip.tsx
+++ b/packages/views/labels/label-chip.tsx
@@ -2,6 +2,7 @@
import type { Label } from "@multica/core/types";
import { X } from "lucide-react";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useT } from "../i18n";
/**
@@ -69,20 +70,22 @@ export function LabelChip({ label, onRemove, className, fullName }: LabelChipPro
>
<span className={nameClass}>{label.name}</span>
{onRemove && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- onRemove();
- }}
- // bg-current/20 uses the computed text color so the hover state is
- // visible on both light and dark chip backgrounds. hover:bg-black/10
- // was invisible on darker chips (anything requiring light text).
- className="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full hover:bg-current/20 focus:outline-none focus:ring-1 focus:ring-current"
- aria-label={t(($) => $.remove_label, { name: label.name })}
- >
- <X className="h-2.5 w-2.5" strokeWidth={2.5} />
- </button>
+ <TooltipHint label={t(($) => $.remove_label, { name: label.name })}>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ onRemove();
+ }}
+ // bg-current/20 uses the computed text color so the hover state is
+ // visible on both light and dark chip backgrounds. hover:bg-black/10
+ // was invisible on darker chips (anything requiring light text).
+ className="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full hover:bg-current/20 focus:outline-none focus:ring-1 focus:ring-current"
+ aria-label={t(($) => $.remove_label, { name: label.name })}
+ >
+ <X className="h-2.5 w-2.5" strokeWidth={2.5} />
+ </button>
+ </TooltipHint>
)}
</span>
);
diff --git a/packages/views/labels/label-manager.tsx b/packages/views/labels/label-manager.tsx
index 2986430f1a..c855f945b3 100644
--- a/packages/views/labels/label-manager.tsx
+++ b/packages/views/labels/label-manager.tsx
@@ -13,6 +13,7 @@ import {
} from "@multica/core/labels";
import type { Label, LabelResourceType } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { Label as FieldLabel } from "@multica/ui/components/ui/label";
@@ -160,13 +161,13 @@ export function LabelManager({ scope }: { scope: LabelScope }) {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.labels.actions.open, { name: label.name })}
+ label={t(($) => $.labels.actions.open, { name: label.name })}
>
<MoreHorizontal className="size-4" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end">
diff --git a/packages/views/layout/help-launcher.tsx b/packages/views/layout/help-launcher.tsx
index 1df5c538aa..e7b3dec709 100644
--- a/packages/views/layout/help-launcher.tsx
+++ b/packages/views/layout/help-launcher.tsx
@@ -17,6 +17,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { useModalStore } from "@multica/core/modals";
import { useConfigStore } from "@multica/core/config";
import { isDesktopShell } from "../platform/local-directory";
@@ -47,13 +48,14 @@ export function HelpLauncher() {
const desktop = isDesktopShell();
return (
<DropdownMenu>
- <DropdownMenuTrigger
- aria-label={t(($) => $.help.trigger)}
- title={t(($) => $.help.trigger)}
- className="inline-flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors cursor-pointer hover:bg-accent hover:text-foreground data-popup-open:bg-accent data-popup-open:text-foreground"
- >
- <CircleHelp className="size-4" />
- </DropdownMenuTrigger>
+ <TooltipHint label={t(($) => $.help.trigger)}>
+ <DropdownMenuTrigger
+ aria-label={t(($) => $.help.trigger)}
+ className="inline-flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors cursor-pointer hover:bg-accent hover:text-foreground data-popup-open:bg-accent data-popup-open:text-foreground"
+ >
+ <CircleHelp className="size-4" />
+ </DropdownMenuTrigger>
+ </TooltipHint>
<DropdownMenuContent
align="end"
side="top"
diff --git a/packages/views/layout/join-discord-card.tsx b/packages/views/layout/join-discord-card.tsx
index 1cb188b80b..b84a2dc7a5 100644
--- a/packages/views/layout/join-discord-card.tsx
+++ b/packages/views/layout/join-discord-card.tsx
@@ -2,6 +2,7 @@
import { X } from "lucide-react";
import { useAuthStore } from "@multica/core/auth";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { DISCORD_URL, DiscordIcon } from "./discord";
import { useDiscordCardDismissed } from "./use-discord-card-dismissed";
import { useT } from "../i18n";
@@ -53,14 +54,16 @@ export function JoinDiscordCard() {
</a>
{/* Revealed on hover/focus so the resting row stays quiet. Coarse
pointers get no hover, so keep it permanently visible there. */}
- <button
- type="button"
- aria-label={t(($) => $.sidebar.discord_card.dismiss)}
- onClick={dismiss}
- className="absolute inset-y-0 right-1 my-auto flex size-6 cursor-pointer items-center justify-center rounded-sm text-muted-foreground opacity-0 ring-sidebar-ring transition-opacity hover:bg-sidebar-accent hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 group-hover/discord:opacity-100 [@media(hover:none)]:opacity-100"
- >
- <X className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.sidebar.discord_card.dismiss)}>
+ <button
+ type="button"
+ aria-label={t(($) => $.sidebar.discord_card.dismiss)}
+ onClick={dismiss}
+ className="absolute inset-y-0 right-1 my-auto flex size-6 cursor-pointer items-center justify-center rounded-sm text-muted-foreground opacity-0 ring-sidebar-ring transition-opacity hover:bg-sidebar-accent hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 group-hover/discord:opacity-100 [@media(hover:none)]:opacity-100"
+ >
+ <X className="size-3.5" />
+ </button>
+ </TooltipHint>
</div>
);
}
diff --git a/packages/views/layout/page-header.tsx b/packages/views/layout/page-header.tsx
index 71c76e4112..528ebc07a0 100644
--- a/packages/views/layout/page-header.tsx
+++ b/packages/views/layout/page-header.tsx
@@ -2,6 +2,7 @@
import { cn } from "@multica/ui/lib/utils";
import { SidebarTrigger, useSidebarSafe } from "@multica/ui/components/ui/sidebar";
+import { ActionShortcutKeycaps } from "../common/shortcut-keycaps";
/**
* The left edge every page shares: the header, the toolbar under it, and any
@@ -65,7 +66,12 @@ export const PAGE_TOOLBAR = cn(
export function CollapsedNavTrigger() {
const sidebar = useSidebarSafe();
if (!sidebar || sidebar.hasExternalTrigger) return null;
- return <SidebarTrigger className="xl:hidden" />;
+ return (
+ <SidebarTrigger
+ className="xl:hidden"
+ shortcut={<ActionShortcutKeycaps action="toggleSidebar" />}
+ />
+ );
}
interface PageHeaderProps {
diff --git a/packages/views/locales/en/common.json b/packages/views/locales/en/common.json
index d86d30b847..30551f3362 100644
--- a/packages/views/locales/en/common.json
+++ b/packages/views/locales/en/common.json
@@ -35,6 +35,7 @@
"cancel": "Cancel",
"delete": "Delete",
"confirm": "Confirm",
+ "more_actions": "More actions",
"loading": "Loading...",
"time": {
"just_now": "just now",
diff --git a/packages/views/locales/en/layout.json b/packages/views/locales/en/layout.json
index 2de5e3fc69..76abed8af4 100644
--- a/packages/views/locales/en/layout.json
+++ b/packages/views/locales/en/layout.json
@@ -40,6 +40,13 @@
"loading_workspace": "Loading workspace…",
"loading_named_prefix": "Loading"
},
+ "window": {
+ "go_back": "Go back",
+ "go_forward": "Go forward",
+ "hold_for_history": "Hold for history",
+ "back_history": "Back history",
+ "forward_history": "Forward history"
+ },
"sidebar": {
"unpin_tooltip": "Unpin",
"workspaces_label": "Workspaces",
diff --git a/packages/views/locales/fr/common.json b/packages/views/locales/fr/common.json
index 07755028e2..68301bb14f 100644
--- a/packages/views/locales/fr/common.json
+++ b/packages/views/locales/fr/common.json
@@ -35,6 +35,7 @@
"cancel": "Annuler",
"delete": "Supprimer",
"confirm": "Confirmer",
+ "more_actions": "Plus d'actions",
"loading": "Chargement...",
"time": {
"just_now": "à l'instant",
diff --git a/packages/views/locales/fr/layout.json b/packages/views/locales/fr/layout.json
index 7c7dc8514d..a9837df863 100644
--- a/packages/views/locales/fr/layout.json
+++ b/packages/views/locales/fr/layout.json
@@ -40,6 +40,13 @@
"loading_workspace": "Chargement de l'espace de travail…",
"loading_named_prefix": "Chargement"
},
+ "window": {
+ "go_back": "Précédent",
+ "go_forward": "Suivant",
+ "hold_for_history": "Maintenir pour l'historique",
+ "back_history": "Historique précédent",
+ "forward_history": "Historique suivant"
+ },
"sidebar": {
"unpin_tooltip": "Détacher",
"workspaces_label": "Espaces de travail",
diff --git a/packages/views/locales/ja/common.json b/packages/views/locales/ja/common.json
index 539a4aa790..6aded4ad73 100644
--- a/packages/views/locales/ja/common.json
+++ b/packages/views/locales/ja/common.json
@@ -35,6 +35,7 @@
"cancel": "キャンセル",
"delete": "削除",
"confirm": "確認",
+ "more_actions": "その他の操作",
"loading": "読み込み中...",
"time": {
"just_now": "たった今",
diff --git a/packages/views/locales/ja/layout.json b/packages/views/locales/ja/layout.json
index ff900f6def..2b566c01df 100644
--- a/packages/views/locales/ja/layout.json
+++ b/packages/views/locales/ja/layout.json
@@ -40,6 +40,13 @@
"loading_workspace": "ワークスペースを読み込み中…",
"loading_named_prefix": "読み込み中"
},
+ "window": {
+ "go_back": "戻る",
+ "go_forward": "進む",
+ "hold_for_history": "長押しで履歴を表示",
+ "back_history": "戻る履歴",
+ "forward_history": "進む履歴"
+ },
"sidebar": {
"unpin_tooltip": "ピン留めを解除",
"workspaces_label": "ワークスペース",
diff --git a/packages/views/locales/ko/common.json b/packages/views/locales/ko/common.json
index d06b923ee4..5d7795233d 100644
--- a/packages/views/locales/ko/common.json
+++ b/packages/views/locales/ko/common.json
@@ -35,6 +35,7 @@
"cancel": "취소",
"delete": "삭제",
"confirm": "확인",
+ "more_actions": "추가 작업",
"loading": "로딩 중...",
"time": {
"just_now": "방금 전",
diff --git a/packages/views/locales/ko/layout.json b/packages/views/locales/ko/layout.json
index 0c482db694..a277f707f1 100644
--- a/packages/views/locales/ko/layout.json
+++ b/packages/views/locales/ko/layout.json
@@ -40,6 +40,13 @@
"loading_workspace": "워크스페이스 로딩 중...",
"loading_named_prefix": "로딩 중"
},
+ "window": {
+ "go_back": "뒤로",
+ "go_forward": "앞으로",
+ "hold_for_history": "길게 눌러 기록 보기",
+ "back_history": "뒤로 기록",
+ "forward_history": "앞으로 기록"
+ },
"sidebar": {
"unpin_tooltip": "고정 해제",
"workspaces_label": "워크스페이스",
diff --git a/packages/views/locales/zh-Hans/common.json b/packages/views/locales/zh-Hans/common.json
index eb6782a93a..58530fc977 100644
--- a/packages/views/locales/zh-Hans/common.json
+++ b/packages/views/locales/zh-Hans/common.json
@@ -35,6 +35,7 @@
"cancel": "取消",
"delete": "删除",
"confirm": "确认",
+ "more_actions": "更多操作",
"loading": "加载中...",
"time": {
"just_now": "刚刚",
diff --git a/packages/views/locales/zh-Hans/layout.json b/packages/views/locales/zh-Hans/layout.json
index 066953ea22..b68080c430 100644
--- a/packages/views/locales/zh-Hans/layout.json
+++ b/packages/views/locales/zh-Hans/layout.json
@@ -40,6 +40,13 @@
"loading_workspace": "正在加载工作区...",
"loading_named_prefix": "正在加载"
},
+ "window": {
+ "go_back": "后退",
+ "go_forward": "前进",
+ "hold_for_history": "长按查看历史",
+ "back_history": "后退历史",
+ "forward_history": "前进历史"
+ },
"sidebar": {
"unpin_tooltip": "取消固定",
"workspaces_label": "工作区",
diff --git a/packages/views/modals/create-issue.tsx b/packages/views/modals/create-issue.tsx
index a8ec38d3c3..ea3136aaf7 100644
--- a/packages/views/modals/create-issue.tsx
+++ b/packages/views/modals/create-issue.tsx
@@ -49,6 +49,7 @@ import {
DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@multica/ui/components/ui/tooltip";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Button } from "@multica/ui/components/ui/button";
import { Switch } from "@multica/ui/components/ui/switch";
import { ContentEditor, type ContentEditorRef, TitleEditor, type TitleEditorRef, useFileDropZone, FileDropOverlay, useUploadGate, useComposerSubmit } from "../editor";
@@ -951,6 +952,7 @@ export function ManualCreatePanel({
<button
type="button"
onClick={() => setIsExpanded(!isExpanded)}
+ aria-label={isExpanded ? t(($) => $.common.collapse_tooltip) : t(($) => $.common.expand_tooltip)}
className="rounded-sm p-1.5 opacity-70 hover:opacity-100 hover:bg-accent/60 transition-all cursor-pointer"
>
{isExpanded ? <Minimize2 className="size-4" /> : <Maximize2 className="size-4" />}
@@ -969,6 +971,7 @@ export function ManualCreatePanel({
<button
type="button"
onClick={onClose}
+ aria-label={t(($) => $.common.close)}
className="rounded-sm p-1.5 opacity-70 hover:opacity-100 hover:bg-accent/60 transition-all cursor-pointer"
>
<XIcon className="size-4" />
@@ -1042,6 +1045,7 @@ export function ManualCreatePanel({
projectId={projectId ?? null}
onUpdate={(u) => { if (u.status) updateStatus(u.status); }}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_status)}
align="start"
open={fieldPickerOpen === "status" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "status" : null)}
@@ -1054,6 +1058,7 @@ export function ManualCreatePanel({
priority={priority}
onUpdate={(u) => { if (u.priority) updatePriority(u.priority); }}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_priority)}
align="start"
open={fieldPickerOpen === "priority" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "priority" : null)}
@@ -1070,6 +1075,7 @@ export function ManualCreatePanel({
u.assignee_id ?? undefined,
)}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_assignee)}
align="start"
open={fieldPickerOpen === "assignee" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "assignee" : null)}
@@ -1085,6 +1091,7 @@ export function ManualCreatePanel({
selectedIds={labelIds}
onSelectedIdsChange={updateLabelIds}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_labels)}
align="start"
open={fieldPickerOpen === "labels" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "labels" : null)}
@@ -1102,6 +1109,7 @@ export function ManualCreatePanel({
clearLabel={tProjects(($) => $.picker.clear_aria)}
/>
}
+ tooltip={tIssues(($) => $.detail.prop_project)}
align="start"
open={fieldPickerOpen === "project" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "project" : null)}
@@ -1115,6 +1123,7 @@ export function ManualCreatePanel({
onUpdate={(u) => setStage(u.stage ?? null)}
maxStage={maxSiblingStage(parentChildren)}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_stage)}
align="start"
/>
)}
@@ -1130,6 +1139,7 @@ export function ManualCreatePanel({
startDate={startDate}
onUpdate={(u) => updateStartDate(u.start_date ?? null)}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_start_date)}
align="start"
open={startDatePickerOpen}
onOpenChange={setStartDatePickerOpen}
@@ -1144,6 +1154,7 @@ export function ManualCreatePanel({
dueDate={dueDate}
onUpdate={(u) => updateDueDate(u.due_date ?? null)}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_due_date)}
align="start"
open={dueDatePickerOpen}
onOpenChange={setDueDatePickerOpen}
@@ -1220,14 +1231,16 @@ export function ManualCreatePanel({
{t(($) => $.create_issue.subissue_of, { identifier: parentIssue.identifier })}
</span>
</button>
- <button
- type="button"
- onClick={() => setParentIssueId(undefined)}
- className="p-1 pr-2 text-muted-foreground hover:text-foreground cursor-pointer"
- aria-label={t(($) => $.create_issue.remove_parent_aria)}
- >
- <XIcon className="size-3" />
- </button>
+ <TooltipHint label={t(($) => $.create_issue.remove_parent_aria)}>
+ <button
+ type="button"
+ onClick={() => setParentIssueId(undefined)}
+ className="p-1 pr-2 text-muted-foreground hover:text-foreground cursor-pointer"
+ aria-label={t(($) => $.create_issue.remove_parent_aria)}
+ >
+ <XIcon className="size-3" />
+ </button>
+ </TooltipHint>
</div>
) : null}
@@ -1242,29 +1255,33 @@ export function ManualCreatePanel({
<ArrowDown className="size-3 text-muted-foreground" />
<span>{t(($) => $.create_issue.subissue_chip, { identifier: c.identifier })}</span>
</div>
- <button
- type="button"
- onClick={() =>
- setChildIssues((prev) => prev.filter((x) => x.id !== c.id))
- }
- className="p-1 pr-2 text-muted-foreground hover:text-foreground cursor-pointer"
- aria-label={t(($) => $.create_issue.remove_subissue_aria, { identifier: c.identifier })}
- >
- <XIcon className="size-3" />
- </button>
+ <TooltipHint label={t(($) => $.create_issue.remove_subissue_aria, { identifier: c.identifier })}>
+ <button
+ type="button"
+ onClick={() =>
+ setChildIssues((prev) => prev.filter((x) => x.id !== c.id))
+ }
+ className="p-1 pr-2 text-muted-foreground hover:text-foreground cursor-pointer"
+ aria-label={t(($) => $.create_issue.remove_subissue_aria, { identifier: c.identifier })}
+ >
+ <XIcon className="size-3" />
+ </button>
+ </TooltipHint>
</div>
))}
{/* Overflow — always the last child so DOM order keeps it at the
end of the wrap flow, no matter how many chips are present. */}
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <PillButton aria-label={t(($) => $.create_issue.more_options_aria)}>
- <MoreHorizontal className="size-3.5" />
- </PillButton>
- }
- />
+ <TooltipHint label={t(($) => $.create_issue.more_options_aria)}>
+ <DropdownMenuTrigger
+ render={
+ <PillButton aria-label={t(($) => $.create_issue.more_options_aria)}>
+ <MoreHorizontal className="size-3.5" />
+ </PillButton>
+ }
+ />
+ </TooltipHint>
<DropdownMenuContent align="start" className="w-auto">
{/* Re-entry points for toolbar fields hidden via
Settings → Preferences → Issue creation. Listed in toolbar order; each opens
@@ -1447,19 +1464,20 @@ export function ManualCreatePanel({
onSelect={(file) => descEditorRef.current?.uploadFile(file)}
/>
</div>
- <button
- type="button"
- onClick={switchToAgent}
- disabled={gate.uploading}
- aria-disabled={gate.uploading || undefined}
- aria-busy={gate.uploading || undefined}
- title={t(($) => $.create_issue.switch_to_agent_tooltip)}
- className="relative group flex shrink-0 items-center gap-1.5 justify-self-end text-caption px-2 py-1 rounded-sm text-muted-foreground bg-brand/5 hover:bg-brand/10 hover:text-foreground transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"
- >
- <ArrowLeftRight className="size-3.5 text-brand transition-transform duration-300 group-hover:rotate-180" />
- {t(($) => $.create_issue.switch_to_agent)}
- <BorderBeam />
- </button>
+ <TooltipHint label={t(($) => $.create_issue.switch_to_agent_tooltip)}>
+ <button
+ type="button"
+ onClick={switchToAgent}
+ disabled={gate.uploading}
+ aria-disabled={gate.uploading || undefined}
+ aria-busy={gate.uploading || undefined}
+ className="relative group flex shrink-0 items-center gap-1.5 justify-self-end text-caption px-2 py-1 rounded-sm text-muted-foreground bg-brand/5 hover:bg-brand/10 hover:text-foreground transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <ArrowLeftRight className="size-3.5 text-brand transition-transform duration-300 group-hover:rotate-180" />
+ {t(($) => $.create_issue.switch_to_agent)}
+ <BorderBeam />
+ </button>
+ </TooltipHint>
<label className="flex shrink-0 items-center gap-1.5 text-caption text-muted-foreground cursor-pointer select-none">
<Switch
size="sm"
diff --git a/packages/views/modals/create-project.tsx b/packages/views/modals/create-project.tsx
index acf2a4542d..c369d09f7d 100644
--- a/packages/views/modals/create-project.tsx
+++ b/packages/views/modals/create-project.tsx
@@ -46,6 +46,7 @@ import {
} from "@multica/ui/components/ui/dropdown-menu";
import { Popover, PopoverTrigger, PopoverContent } from "@multica/ui/components/ui/popover";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Button } from "@multica/ui/components/ui/button";
import { EmojiPicker } from "@multica/ui/components/common/emoji-picker";
import { ContentEditor, type ContentEditorRef, TitleEditor } from "../editor";
@@ -527,17 +528,19 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
<div className="px-5 pb-2 shrink-0">
<Popover open={iconPickerOpen} onOpenChange={setIconPickerOpen}>
- <PopoverTrigger
- render={
- <button
- type="button"
- className="text-display-sm cursor-pointer rounded-lg p-1 -ml-1 hover:bg-accent/60 transition-colors"
- title={t(($) => $.create_project.icon_tooltip)}
- >
- {icon || "📁"}
- </button>
- }
- />
+ <TooltipHint label={t(($) => $.create_project.icon_tooltip)}>
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ className="text-display-sm cursor-pointer rounded-lg p-1 -ml-1 hover:bg-accent/60 transition-colors"
+ aria-label={t(($) => $.create_project.icon_tooltip)}
+ >
+ {icon || "📁"}
+ </button>
+ }
+ />
+ </TooltipHint>
<PopoverContent align="start" className="w-auto p-0">
<EmojiPicker
onSelect={(emoji) => {
@@ -985,14 +988,16 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
{selectedLocalPath}
</div>
</div>
- <button
- type="button"
- onClick={clearLocalDirectory}
- className="text-muted-foreground hover:text-foreground"
- aria-label={t(($) => $.create_project.local_clear)}
- >
- <XIcon className="size-3" />
- </button>
+ <TooltipHint label={t(($) => $.create_project.local_clear)}>
+ <button
+ type="button"
+ onClick={clearLocalDirectory}
+ className="text-muted-foreground hover:text-foreground"
+ aria-label={t(($) => $.create_project.local_clear)}
+ >
+ <XIcon className="size-3" />
+ </button>
+ </TooltipHint>
</div>
<div className="flex items-center gap-1.5">
<Popover open={localModeOpen} onOpenChange={setLocalModeOpen}>
diff --git a/packages/views/modals/create-squad.tsx b/packages/views/modals/create-squad.tsx
index 1da53ef1de..38197d1eb2 100644
--- a/packages/views/modals/create-squad.tsx
+++ b/packages/views/modals/create-squad.tsx
@@ -29,6 +29,7 @@ import {
import { Button } from "@multica/ui/components/ui/button";
import { Input } from "@multica/ui/components/ui/input";
import { Label } from "@multica/ui/components/ui/label";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { toast } from "sonner";
import { useNavigation } from "../navigation";
@@ -592,18 +593,20 @@ function MemberChip({
<span className="inline-flex items-center gap-1 rounded-full border bg-background px-1.5 py-0.5 text-caption">
<ActorAvatar actorType={m.type} actorId={m.id} size="xs" />
<span className="max-w-[120px] truncate">{m.name}</span>
- <button
- type="button"
- onClick={(e) => {
- e.preventDefault();
- e.stopPropagation();
- onRemove();
- }}
- aria-label={t(($) => $.create_squad.members_remove_aria, { name: m.name })}
- className="rounded-full text-muted-foreground hover:text-foreground"
- >
- <X className="h-3 w-3" />
- </button>
+ <TooltipHint label={t(($) => $.create_squad.members_remove_aria, { name: m.name })}>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ onRemove();
+ }}
+ aria-label={t(($) => $.create_squad.members_remove_aria, { name: m.name })}
+ className="rounded-full text-muted-foreground hover:text-foreground"
+ >
+ <X className="h-3 w-3" />
+ </button>
+ </TooltipHint>
</span>
);
}
diff --git a/packages/views/modals/quick-create-issue.test.tsx b/packages/views/modals/quick-create-issue.test.tsx
index 440aebcd7f..13943fd7a5 100644
--- a/packages/views/modals/quick-create-issue.test.tsx
+++ b/packages/views/modals/quick-create-issue.test.tsx
@@ -455,14 +455,6 @@ vi.mock("../issues/components/pickers/property-picker", () => ({
PickerEmpty: () => <div data-testid="picker-empty" />,
}));
-vi.mock("@multica/ui/components/ui/button", () => ({
- Button: ({ children, disabled, onClick }: { children: ReactNode; disabled?: boolean; onClick?: () => void }) => (
- <button type="button" disabled={disabled} onClick={onClick}>
- {children}
- </button>
- ),
-}));
-
vi.mock("@multica/ui/components/ui/switch", () => ({
Switch: ({ checked, onCheckedChange }: { checked: boolean; onCheckedChange: (v: boolean) => void }) => (
<input
@@ -1208,7 +1200,11 @@ describe("AgentCreatePanel", () => {
),
"Ship it",
);
- expect(screen.getByRole("button", { name: /^Create$/i })).toBeDisabled();
+ // Blocked but still hoverable so its tooltip can explain why.
+ const create = screen.getByRole("button", { name: /^Create$/i });
+ expect(create).toHaveAttribute("aria-disabled", "true");
+ await user.click(create);
+ expect(mockQuickCreateIssue).not.toHaveBeenCalled();
});
});
diff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsx
index d6011f3344..4a3040b295 100644
--- a/packages/views/modals/quick-create-issue.tsx
+++ b/packages/views/modals/quick-create-issue.tsx
@@ -24,6 +24,8 @@ import {
DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
import { Button } from "@multica/ui/components/ui/button";
+import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Switch } from "@multica/ui/components/ui/switch";
import { cn } from "@multica/ui/lib/utils";
import { api, ApiError } from "@multica/core/api";
@@ -50,6 +52,7 @@ import {
} from "@multica/core/runtimes";
import { useShortcut } from "@multica/core/shortcuts";
import { ShortcutKeycaps } from "../common/shortcut-keycaps";
+import { DeferredTooltip } from "../common/deferred-tooltip";
import {
contentReferencesAttachment,
type Agent,
@@ -610,6 +613,43 @@ export function AgentCreatePanel({
onClose();
};
+ const createButton = (
+ <Button
+ size="sm"
+ onClick={submit}
+ disabled={!hasContent || !actor || submitting || versionBlocked || gate.uploading || (!!anchorCommentId && !sourcePreview)}
+ aria-disabled={gate.uploading || versionBlocked || undefined}
+ // Sending is a busy state too, not just uploading.
+ aria-busy={gate.uploading || submitting || undefined}
+ // Keeps the button hoverable so its tooltip can say why it is blocked.
+ focusableWhenDisabled={versionBlocked}
+ className={cn(
+ "justify-self-end min-w-28",
+ versionBlocked && "aria-disabled:cursor-not-allowed aria-disabled:opacity-50",
+ justSent && "!bg-emerald-600 !text-white",
+ )}
+ >
+ {submitting ? t(($) => $.create_issue.agent.sending) : gate.uploading ? t(($) => $.create_issue.agent.uploading) : justSent ? (
+ <span className="flex items-center gap-1"><Check className="size-3.5" />{t(($) => $.create_issue.agent.sent_label)}</span>
+ ) : (
+ <>
+ {t(($) => $.create_issue.agent.submit)}
+ {sendShortcut ? (
+ // Touch phones have no ⌘ key and the narrowest footer row
+ // to spare — drop the hint at the same breakpoint the
+ // footer reflows at.
+ <ShortcutKeycaps
+ shortcut={sendShortcut}
+ decorative
+ className="ml-1 max-sm:hidden"
+ keyClassName="border-background/30 bg-background/15 text-primary-foreground shadow-none"
+ />
+ ) : null}
+ </>
+ )}
+ </Button>
+ );
+
return (
<>
<DialogTitle className="sr-only">{t(($) => $.create_issue.sr_agent)}</DialogTitle>
@@ -621,29 +661,39 @@ export function AgentCreatePanel({
<ChevronRight className="size-3 text-faint-foreground" />
<span className="font-medium">{t(($) => $.create_issue.agent_breadcrumb)}</span>
</div>
- {/* Native `title` instead of Base UI Tooltip — Tooltip opens on
+ {/* DeferredTooltip instead of Base UI Tooltip — Tooltip opens on
keyboard focus, and the dialog's focus trap briefly lands focus
on the first focusable element on mount, causing the tooltip to
- auto-pop every open. Same workaround applies to expand. */}
+ auto-pop every open. DeferredTooltip opens on pointer hover only. */}
<div className="flex items-center gap-1">
- <button
- type="button"
- onClick={() => setIsExpanded(!isExpanded)}
- title={isExpanded ? t(($) => $.common.collapse_tooltip) : t(($) => $.common.expand_tooltip)}
- aria-label={isExpanded ? t(($) => $.common.collapse_tooltip) : t(($) => $.common.expand_tooltip)}
- className="rounded-sm p-1.5 opacity-70 hover:opacity-100 hover:bg-accent/60 transition-all cursor-pointer"
- >
- {isExpanded ? <Minimize2 className="size-4" /> : <Maximize2 className="size-4" />}
- </button>
- <button
- type="button"
- onClick={onClose}
- title={t(($) => $.common.close)}
- aria-label={t(($) => $.common.close)}
- className="rounded-sm p-1.5 opacity-70 hover:opacity-100 hover:bg-accent/60 transition-all cursor-pointer"
- >
- <XIcon className="size-4" />
- </button>
+ <DeferredTooltip
+ side="bottom"
+ content={isExpanded ? t(($) => $.common.collapse_tooltip) : t(($) => $.common.expand_tooltip)}
+ trigger={
+ <button
+ type="button"
+ onClick={() => setIsExpanded(!isExpanded)}
+ aria-label={isExpanded ? t(($) => $.common.collapse_tooltip) : t(($) => $.common.expand_tooltip)}
+ className="rounded-sm p-1.5 opacity-70 hover:opacity-100 hover:bg-accent/60 transition-all cursor-pointer"
+ >
+ {isExpanded ? <Minimize2 className="size-4" /> : <Maximize2 className="size-4" />}
+ </button>
+ }
+ />
+ <DeferredTooltip
+ side="bottom"
+ content={t(($) => $.common.close)}
+ trigger={
+ <button
+ type="button"
+ onClick={onClose}
+ aria-label={t(($) => $.common.close)}
+ className="rounded-sm p-1.5 opacity-70 hover:opacity-100 hover:bg-accent/60 transition-all cursor-pointer"
+ >
+ <XIcon className="size-4" />
+ </button>
+ }
+ />
</div>
</div>
@@ -748,6 +798,7 @@ export function AgentCreatePanel({
clearLabel={tProjects(($) => $.picker.clear_aria)}
/>
}
+ tooltip={tIssues(($) => $.detail.prop_project)}
align="start"
open={fieldPickerOpen === "project" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "project" : null)}
@@ -765,6 +816,7 @@ export function AgentCreatePanel({
}
}}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_priority)}
align="start"
open={fieldPickerOpen === "priority" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "priority" : null)}
@@ -781,22 +833,22 @@ export function AgentCreatePanel({
setShared({ dueDate: next });
}}
triggerRender={<PillButton />}
+ tooltip={tIssues(($) => $.detail.prop_due_date)}
align="start"
open={fieldPickerOpen === "due_date" ? true : undefined}
onOpenChange={(open) => setFieldPickerOpen(open ? "due_date" : null)}
/>
)}
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <PillButton
- aria-label={t(($) => $.create_issue.agent.more_fields_aria)}
- title={t(($) => $.create_issue.agent.more_fields_aria)}
- >
- <MoreHorizontal className="size-3.5" />
- </PillButton>
- }
- />
+ <TooltipHint label={t(($) => $.create_issue.agent.more_fields_aria)}>
+ <DropdownMenuTrigger
+ render={
+ <PillButton aria-label={t(($) => $.create_issue.agent.more_fields_aria)}>
+ <MoreHorizontal className="size-3.5" />
+ </PillButton>
+ }
+ />
+ </TooltipHint>
<DropdownMenuContent align="start" className="w-52">
{!visibleFields.includes("project") && projectId === null && (
<DropdownMenuItem onClick={() => setFieldPickerOpen("project")}>
@@ -871,18 +923,19 @@ export function AgentCreatePanel({
</span>
)}
</div>
- <button
- type="button"
- onClick={switchToManual}
- disabled={gate.uploading}
- aria-disabled={gate.uploading || undefined}
- aria-busy={gate.uploading || undefined}
- title={t(($) => $.create_issue.switch_to_manual_tooltip)}
- className="flex shrink-0 items-center gap-1.5 justify-self-end text-caption px-2 py-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"
- >
- <ArrowLeftRight className="size-3.5" />
- {t(($) => $.create_issue.switch_to_manual)}
- </button>
+ <TooltipHint label={t(($) => $.create_issue.switch_to_manual_tooltip)}>
+ <button
+ type="button"
+ onClick={switchToManual}
+ disabled={gate.uploading}
+ aria-disabled={gate.uploading || undefined}
+ aria-busy={gate.uploading || undefined}
+ className="flex shrink-0 items-center gap-1.5 justify-self-end text-caption px-2 py-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ <ArrowLeftRight className="size-3.5" />
+ {t(($) => $.create_issue.switch_to_manual)}
+ </button>
+ </TooltipHint>
<label className="flex shrink-0 items-center gap-1.5 text-caption text-muted-foreground cursor-pointer select-none">
<Switch
size="sm"
@@ -891,42 +944,16 @@ export function AgentCreatePanel({
/>
{t(($) => $.create_issue.create_another)}
</label>
- <Button
- size="sm"
- onClick={submit}
- disabled={!hasContent || !actor || submitting || versionBlocked || gate.uploading || (!!anchorCommentId && !sourcePreview)}
- aria-disabled={gate.uploading || undefined}
- // Sending is a busy state too, not just uploading.
- aria-busy={gate.uploading || submitting || undefined}
- title={
- versionBlocked
- ? t(($) => $.create_issue.agent.version_blocked_tooltip, { min: versionCheck.min })
- : undefined
- }
- className={cn(
- "justify-self-end min-w-28",
- justSent && "!bg-emerald-600 !text-white",
- )}
- >
- {submitting ? t(($) => $.create_issue.agent.sending) : gate.uploading ? t(($) => $.create_issue.agent.uploading) : justSent ? (
- <span className="flex items-center gap-1"><Check className="size-3.5" />{t(($) => $.create_issue.agent.sent_label)}</span>
- ) : (
- <>
- {t(($) => $.create_issue.agent.submit)}
- {sendShortcut ? (
- // Touch phones have no ⌘ key and the narrowest footer row
- // to spare — drop the hint at the same breakpoint the
- // footer reflows at.
- <ShortcutKeycaps
- shortcut={sendShortcut}
- decorative
- className="ml-1 max-sm:hidden"
- keyClassName="border-background/30 bg-background/15 text-primary-foreground shadow-none"
- />
- ) : null}
- </>
- )}
- </Button>
+ {versionBlocked ? (
+ <Tooltip>
+ <TooltipTrigger render={createButton} />
+ <TooltipContent side="top">
+ {t(($) => $.create_issue.agent.version_blocked_tooltip, { min: versionCheck.min })}
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ createButton
+ )}
</div>
</>
);
diff --git a/packages/views/onboarding/components/step-sidebar.tsx b/packages/views/onboarding/components/step-sidebar.tsx
index ad0acff170..580f0114d2 100644
--- a/packages/views/onboarding/components/step-sidebar.tsx
+++ b/packages/views/onboarding/components/step-sidebar.tsx
@@ -7,7 +7,7 @@ import {
type OnboardingStep,
} from "@multica/core/onboarding";
import { cn } from "@multica/ui/lib/utils";
-import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { MulticaIcon } from "@multica/ui/components/common/multica-icon";
import { DotSphere } from "@multica/ui/components/ui/dot-sphere";
import {
@@ -82,18 +82,19 @@ export function StepProgressBar({
return (
<div className="mb-6 flex items-center gap-3 md:hidden">
{onBack ? (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
onClick={onBack}
disabled={backDisabled}
- aria-label={t(($) => $.common.back)}
+ label={t(($) => $.common.back)}
+ tooltipSide="bottom"
className="-ml-2 shrink-0"
style={{ WebkitAppRegion: "no-drag" } as CSSProperties}
>
<ArrowLeft />
- </Button>
+ </IconButton>
) : null}
<span
aria-hidden
@@ -170,17 +171,18 @@ export function StepSidebar({
</span>
</span>
{onBack ? (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
onClick={onBack}
disabled={backDisabled}
- aria-label={t(($) => $.common.back)}
+ label={t(($) => $.common.back)}
+ tooltipSide="bottom"
style={{ WebkitAppRegion: "no-drag" } as CSSProperties}
>
<ArrowLeft />
- </Button>
+ </IconButton>
) : null}
</header>
diff --git a/packages/views/onboarding/steps/cli-install-instructions.tsx b/packages/views/onboarding/steps/cli-install-instructions.tsx
index fea6410c8c..48f8215a52 100644
--- a/packages/views/onboarding/steps/cli-install-instructions.tsx
+++ b/packages/views/onboarding/steps/cli-install-instructions.tsx
@@ -3,6 +3,7 @@
import { useState, type ReactNode } from "react";
import { Check, Copy, Terminal } from "lucide-react";
import { Card, CardContent } from "@multica/ui/components/ui/card";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { CODE_LIGATURE_CLASS } from "@multica/ui/lib/code-style";
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
@@ -24,18 +25,20 @@ function CopyButton({ text }: { text: string }) {
};
return (
- <button
- type="button"
- onClick={handleCopy}
- className="shrink-0 rounded-xs p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
- aria-label={t(($) => $.cli_install.copy_aria)}
- >
- {copied ? (
- <Check className="h-3.5 w-3.5 text-success" />
- ) : (
- <Copy className="h-3.5 w-3.5" />
- )}
- </button>
+ <TooltipHint label={t(($) => $.cli_install.copy_aria)}>
+ <button
+ type="button"
+ onClick={handleCopy}
+ className="shrink-0 rounded-xs p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
+ aria-label={t(($) => $.cli_install.copy_aria)}
+ >
+ {copied ? (
+ <Check className="h-3.5 w-3.5 text-success" />
+ ) : (
+ <Copy className="h-3.5 w-3.5" />
+ )}
+ </button>
+ </TooltipHint>
);
}
diff --git a/packages/views/package.json b/packages/views/package.json
index f46d5a87b0..69c9fc0887 100644
--- a/packages/views/package.json
+++ b/packages/views/package.json
@@ -12,6 +12,7 @@
"./navigation": "./navigation/index.ts",
"./common/actor-avatar": "./common/actor-avatar.tsx",
"./common/cli-install-command": "./common/cli-install-command.tsx",
+ "./common/shortcut-keycaps": "./common/shortcut-keycaps.tsx",
"./editor": "./editor/index.ts",
"./issues/components": "./issues/components/index.ts",
"./issues/hooks": "./issues/hooks/index.ts",
diff --git a/packages/views/projects/components/project-detail.tsx b/packages/views/projects/components/project-detail.tsx
index d9c1f4da08..6591ed6108 100644
--- a/packages/views/projects/components/project-detail.tsx
+++ b/packages/views/projects/components/project-detail.tsx
@@ -35,6 +35,8 @@ import { ProjectWorkflowMenu } from "../../workflows/project-workflow-menu";
import { IssueSurface } from "../../issues/surface/issue-surface";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@multica/ui/components/ui/resizable";
import { Sheet, SheetContent } from "@multica/ui/components/ui/sheet";
import { useIsMobile } from "@multica/ui/hooks/use-mobile";
@@ -114,6 +116,7 @@ function ProjectWorkflowPropRow({ project }: { project: Project }) {
export function ProjectDetail({ projectId }: { projectId: string }) {
const { t } = useT("projects");
+ const { t: tCommon } = useT("common");
const statusLabels = useProjectStatusLabels();
const priorityLabels = useProjectPriorityLabels();
const wsId = useWorkspaceId();
@@ -260,17 +263,19 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
{/* Icon + Title */}
<div>
<Popover open={iconPickerOpen} onOpenChange={setIconPickerOpen}>
- <PopoverTrigger
- render={
- <button
- type="button"
- className="text-display-sm cursor-pointer rounded-lg p-1 -ml-1 hover:bg-accent/60 transition-colors"
- title={t(($) => $.detail.icon_tooltip)}
- >
- {project.icon || "📁"}
- </button>
- }
- />
+ <TooltipHint label={t(($) => $.detail.icon_tooltip)}>
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ className="text-display-sm cursor-pointer rounded-lg p-1 -ml-1 hover:bg-accent/60 transition-colors"
+ aria-label={t(($) => $.detail.icon_tooltip)}
+ >
+ {project.icon || "📁"}
+ </button>
+ }
+ />
+ </TooltipHint>
<PopoverContent align="start" className="w-auto p-0">
<EmojiPicker
onSelect={(emoji) => {
@@ -498,11 +503,10 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
actions={
<>
<ProjectWorkflowMenu project={project} />
- <Button
- variant="ghost"
- size="icon-sm"
+ <IconButton
+ label={isPinned ? t(($) => $.detail.unpin_tooltip) : t(($) => $.detail.pin_tooltip)}
+ tooltipSide="bottom"
className={cn("text-muted-foreground", isPinned && "text-foreground")}
- title={isPinned ? t(($) => $.detail.unpin_tooltip) : t(($) => $.detail.pin_tooltip)}
onClick={() => {
if (isPinned) {
deletePinMut.mutate({ itemType: "project", itemId: projectId });
@@ -512,13 +516,17 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
}}
>
{isPinned ? <PinOff /> : <Pin />}
- </Button>
+ </IconButton>
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button variant="ghost" size="icon-sm" className="text-muted-foreground">
+ <IconButton
+ label={tCommon(($) => $.more_actions)}
+ tooltipSide="bottom"
+ className="text-muted-foreground"
+ >
<MoreHorizontal />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end" className="w-auto">
diff --git a/packages/views/projects/components/project-picker.tsx b/packages/views/projects/components/project-picker.tsx
index 0db5090107..8bba0ef735 100644
--- a/packages/views/projects/components/project-picker.tsx
+++ b/packages/views/projects/components/project-picker.tsx
@@ -20,6 +20,7 @@ export function ProjectPicker({
projectId,
onUpdate,
triggerRender,
+ tooltip,
align = "start",
defaultOpen = false,
open: controlledOpen,
@@ -29,6 +30,8 @@ export function ProjectPicker({
projectId: string | null;
onUpdate: (updates: Partial<UpdateIssueRequest>) => void;
triggerRender?: React.ReactElement;
+ /** Hover tooltip naming the property; hidden while the picker is open. */
+ tooltip?: React.ReactNode;
align?: "start" | "center" | "end";
/** Open the dropdown on first mount. Used by progressive-disclosure
* sidebars so a newly-added field immediately enters edit state. */
@@ -81,6 +84,7 @@ export function ProjectPicker({
searchPlaceholder={t(($) => $.picker.search_placeholder)}
onSearchChange={setFilter}
triggerRender={resolvedTriggerRender}
+ tooltip={tooltip}
trigger={
current ? (
<>
diff --git a/packages/views/projects/components/project-resources-github-ref.test.tsx b/packages/views/projects/components/project-resources-github-ref.test.tsx
index 8ac32fec7e..b140025de5 100644
--- a/packages/views/projects/components/project-resources-github-ref.test.tsx
+++ b/packages/views/projects/components/project-resources-github-ref.test.tsx
@@ -131,7 +131,7 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {
it("saves a new ref while preserving the rest of the stored ref", async () => {
renderWithI18n(<ProjectResourcesSection projectId="p1" />);
- fireEvent.click(screen.getAllByTitle(/change the branch tasks work on/i)[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: /change the branch tasks work on/i })[0]!);
const input = screen.getByLabelText(/starting branch/i);
fireEvent.change(input, { target: { value: "release/2026-10" } });
fireEvent.click(screen.getByRole("button", { name: /^save$/i }));
@@ -154,7 +154,7 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {
it("clearing the field drops the key so tasks fall back to the default branch", async () => {
renderWithI18n(<ProjectResourcesSection projectId="p1" />);
- fireEvent.click(screen.getAllByTitle(/change the branch tasks work on/i)[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: /change the branch tasks work on/i })[0]!);
fireEvent.change(screen.getByLabelText(/starting branch/i), {
target: { value: "" },
});
@@ -173,7 +173,7 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {
it("refuses to save a ref git could never resolve", async () => {
renderWithI18n(<ProjectResourcesSection projectId="p1" />);
- fireEvent.click(screen.getAllByTitle(/change the branch tasks work on/i)[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: /change the branch tasks work on/i })[0]!);
fireEvent.change(screen.getByLabelText(/starting branch/i), {
target: { value: "main..dev" },
});
@@ -315,7 +315,7 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {
it("declines a pasted commit id and points at the per-task escape hatch", () => {
renderWithI18n(<ProjectResourcesSection projectId="p1" />);
- fireEvent.click(screen.getAllByTitle(/change the branch tasks work on/i)[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: /change the branch tasks work on/i })[0]!);
fireEvent.change(screen.getByLabelText(/starting branch/i), {
target: { value: "5e0b1cfa0a7d6a1a0f4b3f2e1d0c9b8a7f6e5d4c" },
});
@@ -330,7 +330,7 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {
it("still accepts a tag-shaped name — it could be a branch, and only the remote knows", async () => {
renderWithI18n(<ProjectResourcesSection projectId="p1" />);
- fireEvent.click(screen.getAllByTitle(/change the branch tasks work on/i)[0]!);
+ fireEvent.click(screen.getAllByRole("button", { name: /change the branch tasks work on/i })[0]!);
fireEvent.change(screen.getByLabelText(/starting branch/i), {
target: { value: "v1.4.0" },
});
diff --git a/packages/views/projects/components/project-resources-local-directory.test.tsx b/packages/views/projects/components/project-resources-local-directory.test.tsx
index ccb19dab6c..34c04e2b8a 100644
--- a/packages/views/projects/components/project-resources-local-directory.test.tsx
+++ b/packages/views/projects/components/project-resources-local-directory.test.tsx
@@ -83,9 +83,9 @@ describe("ProjectResourcesSection — local directory row", () => {
// change how tasks run on the folder.
it("offers the execution mode and remove actions, and no rename", () => {
renderWithI18n(<ProjectResourcesSection projectId="p1" />);
- expect(screen.getByTitle(strings.mode_edit_tooltip)).toBeInTheDocument();
- expect(screen.getByTitle(strings.remove_tooltip)).toBeInTheDocument();
- expect(screen.queryByTitle(/rename/i)).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: strings.mode_edit_tooltip })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: strings.remove_tooltip })).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /rename/i })).not.toBeInTheDocument();
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
});
});
diff --git a/packages/views/projects/components/project-resources-section.tsx b/packages/views/projects/components/project-resources-section.tsx
index 1c10c80a2b..190b9911d7 100644
--- a/packages/views/projects/components/project-resources-section.tsx
+++ b/packages/views/projects/components/project-resources-section.tsx
@@ -44,6 +44,7 @@ import {
TooltipTrigger,
TooltipContent,
} from "@multica/ui/components/ui/tooltip";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
isDesktopShell,
pickDirectory,
@@ -683,22 +684,26 @@ function ResourceRow({
</span>
)}
</div>
- <button
- type="button"
- onClick={() => onEditGithubRef(resource)}
- className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
- title={t(($) => $.resources.ref_edit_tooltip)}
- >
- <GitBranch className="size-3 text-muted-foreground" />
- </button>
- <button
- type="button"
- onClick={onRemove}
- className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
- title={t(($) => $.resources.remove_tooltip)}
- >
- <Trash2 className="size-3 text-muted-foreground" />
- </button>
+ <TooltipHint label={t(($) => $.resources.ref_edit_tooltip)}>
+ <button
+ type="button"
+ onClick={() => onEditGithubRef(resource)}
+ className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
+ aria-label={t(($) => $.resources.ref_edit_tooltip)}
+ >
+ <GitBranch className="size-3 text-muted-foreground" />
+ </button>
+ </TooltipHint>
+ <TooltipHint label={t(($) => $.resources.remove_tooltip)}>
+ <button
+ type="button"
+ onClick={onRemove}
+ className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
+ aria-label={t(($) => $.resources.remove_tooltip)}
+ >
+ <Trash2 className="size-3 text-muted-foreground" />
+ </button>
+ </TooltipHint>
</div>
{/* Its own line rather than appended to the link text: a custom label
takes that slot, and this panel is narrow enough that an inline
@@ -747,14 +752,16 @@ function ResourceRow({
<span className="truncate flex-1">
{resource.label || resource.resource_type}
</span>
- <button
- type="button"
- onClick={onRemove}
- className="rounded-sm p-0.5 hover:bg-accent"
- title={t(($) => $.resources.remove_tooltip)}
- >
- <Trash2 className="size-3" />
- </button>
+ <TooltipHint label={t(($) => $.resources.remove_tooltip)}>
+ <button
+ type="button"
+ onClick={onRemove}
+ className="rounded-sm p-0.5 hover:bg-accent"
+ aria-label={t(($) => $.resources.remove_tooltip)}
+ >
+ <Trash2 className="size-3" />
+ </button>
+ </TooltipHint>
</div>
);
}
@@ -836,22 +843,26 @@ function LocalDirectoryRow({
{/* Not gated on `mismatch`: switching the mode only rewrites a field, so
it works from the web app or another device, unlike the folder
picker. */}
- <button
- type="button"
- onClick={() => onEditMode(resource)}
- className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
- title={t(($) => $.resources.mode_edit_tooltip)}
- >
- <GitBranch className="size-3 text-muted-foreground" />
- </button>
- <button
- type="button"
- onClick={onRemove}
- className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
- title={t(($) => $.resources.remove_tooltip)}
- >
- <Trash2 className="size-3 text-muted-foreground" />
- </button>
+ <TooltipHint label={t(($) => $.resources.mode_edit_tooltip)}>
+ <button
+ type="button"
+ onClick={() => onEditMode(resource)}
+ className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
+ aria-label={t(($) => $.resources.mode_edit_tooltip)}
+ >
+ <GitBranch className="size-3 text-muted-foreground" />
+ </button>
+ </TooltipHint>
+ <TooltipHint label={t(($) => $.resources.remove_tooltip)}>
+ <button
+ type="button"
+ onClick={onRemove}
+ className="opacity-0 group-hover:opacity-100 transition-opacity rounded-sm p-0.5 hover:bg-accent"
+ aria-label={t(($) => $.resources.remove_tooltip)}
+ >
+ <Trash2 className="size-3 text-muted-foreground" />
+ </button>
+ </TooltipHint>
</div>
);
}
diff --git a/packages/views/projects/components/projects-page.tsx b/packages/views/projects/components/projects-page.tsx
index ae70bc48fe..c67ee08a12 100644
--- a/packages/views/projects/components/projects-page.tsx
+++ b/packages/views/projects/components/projects-page.tsx
@@ -91,6 +91,8 @@ import {
TooltipContent,
TooltipTrigger,
} from "@multica/ui/components/ui/tooltip";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import type {
MemberWithUser,
Project,
@@ -111,6 +113,7 @@ import { ProjectStatusBadge, ProjectPriorityBadge } from "./project-badge";
import { ProjectLeadPicker } from "./project-lead-picker";
import { PAGE_GUTTER, PAGE_TOOLBAR } from "../../layout/page-header";
import { cn } from "@multica/ui/lib/utils";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
// Sort order maps for the enum columns (header sort needs a total order).
const PRIORITY_ORDER: Record<ProjectPriority, number> = {
@@ -245,15 +248,20 @@ function ProjectRowActions({
return (
<>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={t(($) => $.page.row_menu)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
- >
- <MoreHorizontal className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.page.row_menu)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.page.row_menu)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ >
+ <MoreHorizontal className="size-4" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-44">
@@ -716,14 +724,16 @@ function ProjectBatchToolbar({
<span className="text-body font-medium">
{t(($) => $.page.selected, { count: rows.length })}
</span>
- <button
- type="button"
- aria-label={t(($) => $.page.clear_selection)}
- onClick={onClear}
- className="rounded-xs p-0.5 transition-colors hover:bg-accent"
- >
- <X className="size-3.5 text-muted-foreground" />
- </button>
+ <TooltipHint label={t(($) => $.page.clear_selection)}>
+ <button
+ type="button"
+ aria-label={t(($) => $.page.clear_selection)}
+ onClick={onClear}
+ className="rounded-xs p-0.5 transition-colors hover:bg-accent"
+ >
+ <X className="size-3.5 text-muted-foreground" />
+ </button>
+ </TooltipHint>
</div>
{anyUnpinned && (
<Button
@@ -1138,14 +1148,14 @@ export function ProjectsPage() {
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
- <Button
+ <IconButton
variant="outline"
size="icon-sm"
onClick={() => setSortDirection(sortDirection === "asc" ? "desc" : "asc")}
- title={sortDirection === "asc" ? t(($) => $.toolbar.direction_asc) : t(($) => $.toolbar.direction_desc)}
+ label={sortDirection === "asc" ? t(($) => $.toolbar.direction_asc) : t(($) => $.toolbar.direction_desc)}
>
{sortDirection === "asc" ? <ArrowUp className="size-3.5" /> : <ArrowDown className="size-3.5" />}
- </Button>
+ </IconButton>
</div>
</div>
{isCompact && (
diff --git a/packages/views/rich-content/rich-code-block.tsx b/packages/views/rich-content/rich-code-block.tsx
index 8b1415ae65..76d8e45d7e 100644
--- a/packages/views/rich-content/rich-code-block.tsx
+++ b/packages/views/rich-content/rich-code-block.tsx
@@ -30,6 +30,7 @@ import { Check, Copy } from "lucide-react";
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
import { useT } from "../i18n";
+import { DeferredTooltip } from "../common/deferred-tooltip";
import {
MermaidBlock,
MERMAID_BLOCK_DEFAULT_RESERVED_PX,
@@ -144,19 +145,23 @@ export function CodeBlockShell({
{language}
</span>
)}
- <button
- type="button"
- onClick={handleCopy}
- className="flex h-6 w-6 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
- title={copyLabel}
- aria-label={copyLabel}
- >
- {copied ? (
- <Check className="h-3.5 w-3.5" />
- ) : (
- <Copy className="h-3.5 w-3.5" />
- )}
- </button>
+ <DeferredTooltip
+ content={copyLabel}
+ trigger={
+ <button
+ type="button"
+ onClick={handleCopy}
+ className="flex h-6 w-6 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
+ aria-label={copyLabel}
+ >
+ {copied ? (
+ <Check className="h-3.5 w-3.5" />
+ ) : (
+ <Copy className="h-3.5 w-3.5" />
+ )}
+ </button>
+ }
+ />
</div>
{/* No extra right padding: `.rich-text-editor pre` outranks utility
padding classes anyway, and the editable NodeView uses the same
diff --git a/packages/views/rich-content/rich-table-dialog.tsx b/packages/views/rich-content/rich-table-dialog.tsx
index bcf5f12d75..c59f683031 100644
--- a/packages/views/rich-content/rich-table-dialog.tsx
+++ b/packages/views/rich-content/rich-table-dialog.tsx
@@ -21,6 +21,7 @@ import {
} from "@tanstack/react-table";
import { Check, Copy, Search, X } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { DataTable } from "@multica/ui/components/ui/data-table";
import {
Dialog,
@@ -184,16 +185,17 @@ export function RichTableDialog({ model, open, onOpenChange, getMarkdown }: Rich
className="h-7 pr-7 pl-7 text-caption"
/>
{filter && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
- aria-label={t(($) => $.table.clear_filter)}
+ label={t(($) => $.table.clear_filter)}
+ tooltipSide="bottom"
onClick={() => setFilter("")}
className="absolute top-0.5 right-0.5 text-muted-foreground"
>
<X className="size-3" />
- </Button>
+ </IconButton>
)}
</div>
<Button type="button" variant="outline" size="sm" onClick={() => copy("markdown", getMarkdown())}>
@@ -210,7 +212,14 @@ export function RichTableDialog({ model, open, onOpenChange, getMarkdown }: Rich
{t(($) => $.table.copy_csv)}
</Button>
<DialogClose
- render={<Button variant="ghost" size="icon-sm" aria-label={t(($) => $.table.close)} />}
+ render={
+ <IconButton
+ variant="ghost"
+ size="icon-sm"
+ label={t(($) => $.table.close)}
+ tooltipSide="bottom"
+ />
+ }
>
<X />
</DialogClose>
diff --git a/packages/views/rich-content/rich-table.tsx b/packages/views/rich-content/rich-table.tsx
index ce7d0c55f0..98343deaae 100644
--- a/packages/views/rich-content/rich-table.tsx
+++ b/packages/views/rich-content/rich-table.tsx
@@ -35,6 +35,7 @@ import { Check, Copy, Maximize2, RotateCcw } from "lucide-react";
import { copyText } from "@multica/ui/lib/clipboard";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../i18n";
+import { DeferredTooltip } from "../common/deferred-tooltip";
import { RichTableDialog } from "./rich-table-dialog";
import {
columnWidthKey,
@@ -406,24 +407,32 @@ export function RichTableFrame({ model, getMarkdown, tableRef: onTable, children
{t(($) => $.table.reset_widths)}
</button>
)}
- <button
- type="button"
- onClick={() => setExpanded(true)}
- className={cn(toolbarButton, "w-6")}
- title={t(($) => $.table.expand)}
- aria-label={t(($) => $.table.expand)}
- >
- <Maximize2 className="size-3.5" />
- </button>
- <button
- type="button"
- onClick={copyMarkdown}
- className={cn(toolbarButton, "w-6")}
- title={copied ? t(($) => $.table.copied) : t(($) => $.table.copy_markdown)}
- aria-label={t(($) => $.table.copy_markdown)}
- >
- {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
- </button>
+ <DeferredTooltip
+ content={t(($) => $.table.expand)}
+ trigger={
+ <button
+ type="button"
+ onClick={() => setExpanded(true)}
+ className={cn(toolbarButton, "w-6")}
+ aria-label={t(($) => $.table.expand)}
+ >
+ <Maximize2 className="size-3.5" />
+ </button>
+ }
+ />
+ <DeferredTooltip
+ content={copied ? t(($) => $.table.copied) : t(($) => $.table.copy_markdown)}
+ trigger={
+ <button
+ type="button"
+ onClick={copyMarkdown}
+ className={cn(toolbarButton, "w-6")}
+ aria-label={t(($) => $.table.copy_markdown)}
+ >
+ {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
+ </button>
+ }
+ />
</div>
<div className="relative">
<div ref={wrapperRef} className="tableWrapper">
diff --git a/packages/views/runtimes/components/connect-remote-dialog.tsx b/packages/views/runtimes/components/connect-remote-dialog.tsx
index 29e0bfd065..dadc61d0af 100644
--- a/packages/views/runtimes/components/connect-remote-dialog.tsx
+++ b/packages/views/runtimes/components/connect-remote-dialog.tsx
@@ -24,6 +24,7 @@ import {
DialogTitle,
} from "@multica/ui/components/ui/dialog";
import { Button } from "@multica/ui/components/ui/button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { CODE_LIGATURE_CLASS } from "@multica/ui/lib/code-style";
import { copyText } from "@multica/ui/lib/clipboard";
import {
@@ -179,18 +180,20 @@ function CopyButton({ text, ariaLabel }: { text: string; ariaLabel: string }) {
};
return (
- <button
- type="button"
- onClick={handleCopy}
- aria-label={ariaLabel}
- className="shrink-0 rounded-xs p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- >
- {copied ? (
- <Check className="h-3.5 w-3.5 text-success" aria-hidden />
- ) : (
- <Copy className="h-3.5 w-3.5" aria-hidden />
- )}
- </button>
+ <TooltipHint label={ariaLabel}>
+ <button
+ type="button"
+ onClick={handleCopy}
+ aria-label={ariaLabel}
+ className="shrink-0 rounded-xs p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {copied ? (
+ <Check className="h-3.5 w-3.5 text-success" aria-hidden />
+ ) : (
+ <Copy className="h-3.5 w-3.5" aria-hidden />
+ )}
+ </button>
+ </TooltipHint>
);
}
diff --git a/packages/views/runtimes/components/custom-pricing-dialog.tsx b/packages/views/runtimes/components/custom-pricing-dialog.tsx
index 211779d06d..e1e1ab3c80 100644
--- a/packages/views/runtimes/components/custom-pricing-dialog.tsx
+++ b/packages/views/runtimes/components/custom-pricing-dialog.tsx
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import { Trash2 } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
Dialog,
DialogContent,
@@ -146,16 +147,15 @@ export function CustomPricingDialog({ open, onOpenChange, unmappedModels }: Prop
<div className="flex items-center justify-between gap-2">
<code className="truncate font-mono text-caption">{key}</code>
{hasOverride && (
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-xs"
onClick={() => removeCustomPricing(key)}
- aria-label={t(($) => $.usage.custom_pricing.remove_aria)}
- title={t(($) => $.usage.custom_pricing.remove_aria)}
+ label={t(($) => $.usage.custom_pricing.remove_aria)}
>
<Trash2 />
- </Button>
+ </IconButton>
)}
</div>
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
diff --git a/packages/views/runtimes/components/runtime-list.tsx b/packages/views/runtimes/components/runtime-list.tsx
index 341df3f742..9c40690109 100644
--- a/packages/views/runtimes/components/runtime-list.tsx
+++ b/packages/views/runtimes/components/runtime-list.tsx
@@ -74,6 +74,7 @@ import {
pendingRuntimeCommandName,
} from "./pending-runtime";
import { useT, useTimeAgo } from "../../i18n";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
// The machine detail's runtimes table on the shared ListGrid. Paradigm
// pieces are taken À LA CARTE here: subgrid template + var-width tracks +
@@ -581,15 +582,20 @@ export function RuntimeRowMenu({
return (
<>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={t(($) => $.list.row_actions_aria)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
- >
- <MoreHorizontal className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.list.row_actions_aria)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.list.row_actions_aria)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ >
+ <MoreHorizontal className="size-4" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-40">
diff --git a/packages/views/runtimes/components/runtime-profiles-dialog.tsx b/packages/views/runtimes/components/runtime-profiles-dialog.tsx
index 4bc9c90594..42aad6aa8f 100644
--- a/packages/views/runtimes/components/runtime-profiles-dialog.tsx
+++ b/packages/views/runtimes/components/runtime-profiles-dialog.tsx
@@ -26,6 +26,7 @@ import {
useUpdateRuntimeProfile,
} from "@multica/core/runtimes";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
Dialog,
DialogClose,
@@ -147,17 +148,17 @@ export function RuntimeProfilesDialog({
)}
<DialogClose
render={
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
className="shrink-0"
- aria-label={t(($) => $.profiles.close)}
+ label={t(($) => $.profiles.close)}
+ tooltipSide="bottom"
/>
}
>
<X aria-hidden="true" className="h-4 w-4" />
- <span className="sr-only">{t(($) => $.profiles.close)}</span>
</DialogClose>
</div>
</div>
diff --git a/packages/views/settings/components/billing-tab.tsx b/packages/views/settings/components/billing-tab.tsx
index 408930cca8..d1e5dcff82 100644
--- a/packages/views/settings/components/billing-tab.tsx
+++ b/packages/views/settings/components/billing-tab.tsx
@@ -48,6 +48,7 @@ import {
} from "@multica/ui/components/ui/alert-dialog";
import { Badge } from "@multica/ui/components/ui/badge";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
Dialog,
DialogContent,
@@ -1461,13 +1462,13 @@ function BillingTabContent() {
<Popover>
<PopoverTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-xs"
- aria-label={t(($) => $.workspace.seats.available_help)}
+ label={t(($) => $.workspace.seats.available_help)}
>
<Info className="size-3.5" />
- </Button>
+ </IconButton>
}
/>
<PopoverContent align="start">
diff --git a/packages/views/settings/components/code-tab.tsx b/packages/views/settings/components/code-tab.tsx
index e254279248..721337bcc9 100644
--- a/packages/views/settings/components/code-tab.tsx
+++ b/packages/views/settings/components/code-tab.tsx
@@ -5,6 +5,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
import { MoreHorizontal, Pause, Play, Unplug } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Switch } from "@multica/ui/components/ui/switch";
import {
AlertDialog,
@@ -220,10 +221,10 @@ export function CodeTab() {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.code.github_actions)}
+ label={t(($) => $.code.github_actions)}
/>
}
>
diff --git a/packages/views/settings/components/code-vcs.tsx b/packages/views/settings/components/code-vcs.tsx
index 3326f4119d..2b290ed8ee 100644
--- a/packages/views/settings/components/code-vcs.tsx
+++ b/packages/views/settings/components/code-vcs.tsx
@@ -5,6 +5,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
import { Copy, FolderGit2, GitBranch, MoreHorizontal, RefreshCw, Unplug } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { Label } from "@multica/ui/components/ui/label";
import {
@@ -188,10 +189,10 @@ export function VCSConnectionRows() {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.vcs.connection_actions, { url: c.instance_url })}
+ label={t(($) => $.vcs.connection_actions, { url: c.instance_url })}
/>
}
>
@@ -447,15 +448,15 @@ function CopyField({
value={value}
className={mono ? "min-w-0 font-mono text-caption" : "min-w-0 text-caption"}
/>
- <Button
+ <IconButton
variant="outline"
size="icon-sm"
className="shrink-0"
onClick={() => onCopy(value)}
- aria-label={`${copyLabel}: ${label}`}
+ label={`${copyLabel}: ${label}`}
>
<Copy />
- </Button>
+ </IconButton>
</div>
</div>
);
diff --git a/packages/views/settings/components/dingtalk-tab.tsx b/packages/views/settings/components/dingtalk-tab.tsx
index b0f90d8975..4ef9f5db4b 100644
--- a/packages/views/settings/components/dingtalk-tab.tsx
+++ b/packages/views/settings/components/dingtalk-tab.tsx
@@ -54,6 +54,7 @@ import { ActorAvatar } from "../../common/actor-avatar";
import { docsLocalePrefix } from "../../common/docs-locale";
import { openExternal } from "../../platform";
import { useT, useTimeAgo } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
const dingTalkChatManagePermission = "qyapi_chat_manage";
@@ -925,21 +926,24 @@ export function DingTalkAgentBindButton({
className={cn("flex flex-wrap items-center gap-2", className)}
data-testid="dingtalk-agent-bind-buttons"
>
- <Button
- variant="outline"
- size="sm"
- onClick={() => setDialogOpen(true)}
- disabled={!agentId}
- title={
+ <TooltipHint
+ label={
agentName
? t(($) => $.dingtalk.bind_button_title, { agent: agentName })
: undefined
}
- data-testid="dingtalk-agent-connect"
>
- <DingTalkMark className="h-4 w-4" />
- {t(($) => $.dingtalk.bind_button)}
- </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setDialogOpen(true)}
+ disabled={!agentId}
+ data-testid="dingtalk-agent-connect"
+ >
+ <DingTalkMark className="h-4 w-4" />
+ {t(($) => $.dingtalk.bind_button)}
+ </Button>
+ </TooltipHint>
<Dialog
open={dialogOpen}
@@ -1106,20 +1110,21 @@ function DingTalkAgentBotConnectedBadge({
botIdentityIssue={botIdentityIssue}
showBotIdentity={botName !== undefined || botIdentityIssue !== undefined}
/>
- <Button
- variant="destructive"
- size="sm"
- onClick={() => setConfirmOpen(true)}
- disabled={disconnecting}
- title={t(($) => $.dingtalk.agent_bot_disconnect_tooltip)}
- aria-label={t(($) => $.dingtalk.disconnect)}
- data-testid="dingtalk-agent-bot-disconnect"
- >
- <Trash2 className="h-3 w-3" aria-hidden="true" />
- {disconnecting
- ? t(($) => $.dingtalk.disconnecting)
- : t(($) => $.dingtalk.disconnect)}
- </Button>
+ <TooltipHint label={t(($) => $.dingtalk.agent_bot_disconnect_tooltip)}>
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={() => setConfirmOpen(true)}
+ disabled={disconnecting}
+ aria-label={t(($) => $.dingtalk.disconnect)}
+ data-testid="dingtalk-agent-bot-disconnect"
+ >
+ <Trash2 className="h-3 w-3" aria-hidden="true" />
+ {disconnecting
+ ? t(($) => $.dingtalk.disconnecting)
+ : t(($) => $.dingtalk.disconnect)}
+ </Button>
+ </TooltipHint>
</div>
<AlertDialog
diff --git a/packages/views/settings/components/issue-statuses-tab.tsx b/packages/views/settings/components/issue-statuses-tab.tsx
index efd685decf..5bef50f537 100644
--- a/packages/views/settings/components/issue-statuses-tab.tsx
+++ b/packages/views/settings/components/issue-statuses-tab.tsx
@@ -61,6 +61,8 @@ import type {
} from "@multica/core/types";
import { ISSUE_STATUS_ICONS } from "@multica/core/types/issue-status";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { Label as FieldLabel } from "@multica/ui/components/ui/label";
@@ -493,16 +495,18 @@ function StatusRow({
className={`group/row relative flex min-h-12 items-center gap-2 bg-card py-2 pl-2 pr-4 motion-reduce:transition-none! ${isDragging ? "z-10 shadow-[var(--surface-shadow)]" : ""} ${archived ? "opacity-60" : ""}`}
>
{canReorder ? (
- <button
- type="button"
- disabled={isReordering}
- aria-label={t(($) => $.issue_statuses.actions.reorder, { name: label })}
- className="flex size-6 shrink-0 touch-none items-center justify-center rounded-md cursor-grab text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring active:cursor-grabbing [@media(pointer:coarse)]:size-11"
- {...attributes}
- {...listeners}
- >
- <GripVertical className="size-4" />
- </button>
+ <TooltipHint label={t(($) => $.issue_statuses.actions.reorder, { name: label })}>
+ <button
+ type="button"
+ disabled={isReordering}
+ aria-label={t(($) => $.issue_statuses.actions.reorder, { name: label })}
+ className="flex size-6 shrink-0 touch-none items-center justify-center rounded-md cursor-grab text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring active:cursor-grabbing [@media(pointer:coarse)]:size-11"
+ {...attributes}
+ {...listeners}
+ >
+ <GripVertical className="size-4" />
+ </button>
+ </TooltipHint>
) : <span className="size-6 shrink-0 [@media(pointer:coarse)]:size-11" />}
<StatusIcon
status={entry.key}
@@ -563,14 +567,14 @@ function StatusRow({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.issue_statuses.actions.open, { name: label })}
+ label={t(($) => $.issue_statuses.actions.open, { name: label })}
className="shrink-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 data-popup-open:opacity-100 [@media(hover:hover)]:opacity-0 [@media(pointer:coarse)]:size-11 [@media(pointer:coarse)]:opacity-100"
>
<MoreHorizontal className="size-4" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end">
@@ -822,24 +826,24 @@ function StatusEditorDialog({
</legend>
<div className="flex flex-wrap gap-2">
{(["", ...ISSUE_STATUS_ICONS] as const).map((icon) => (
- <Button
- key={icon}
- type="button"
- variant={draft.icon === icon ? "secondary" : "outline"}
- size={icon ? "icon" : "default"}
- className={`${icon ? "size-11" : "h-11"} aria-pressed:ring-2 aria-pressed:ring-ring`}
- aria-label={t(($) => $.issue_statuses.editor.icon_shapes[icon || "default"])}
- aria-pressed={draft.icon === icon}
- title={t(($) => $.issue_statuses.editor.icon_shapes[icon || "default"])}
- onClick={() => {
- setIconChanged(true);
- setDraft((current) => ({ ...current, icon }));
- }}
- >
- {icon
- ? <StatusIcon status="" category={draft.category} color={draft.color} icon={icon} className="size-5" />
- : t(($) => $.issue_statuses.editor.icon_shapes.default)}
- </Button>
+ <TooltipHint key={icon} label={icon ? t(($) => $.issue_statuses.editor.icon_shapes[icon]) : undefined}>
+ <Button
+ type="button"
+ variant={draft.icon === icon ? "secondary" : "outline"}
+ size={icon ? "icon" : "default"}
+ className={`${icon ? "size-11" : "h-11"} aria-pressed:ring-2 aria-pressed:ring-ring`}
+ aria-label={t(($) => $.issue_statuses.editor.icon_shapes[icon || "default"])}
+ aria-pressed={draft.icon === icon}
+ onClick={() => {
+ setIconChanged(true);
+ setDraft((current) => ({ ...current, icon }));
+ }}
+ >
+ {icon
+ ? <StatusIcon status="" category={draft.category} color={draft.color} icon={icon} className="size-5" />
+ : t(($) => $.issue_statuses.editor.icon_shapes.default)}
+ </Button>
+ </TooltipHint>
))}
</div>
</fieldset>
diff --git a/packages/views/settings/components/keyboard-shortcuts-tab.tsx b/packages/views/settings/components/keyboard-shortcuts-tab.tsx
index 6a5ad8e54e..5ea156996c 100644
--- a/packages/views/settings/components/keyboard-shortcuts-tab.tsx
+++ b/packages/views/settings/components/keyboard-shortcuts-tab.tsx
@@ -3,6 +3,7 @@
import { useMemo, useState } from "react";
import { Keyboard, RotateCcw, Search, X } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import {
AlertDialog,
@@ -324,28 +325,26 @@ function ShortcutRow({
</span>
)}
</button>
- <Button
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
onClick={onReset}
disabled={!customized}
- aria-label={t(($) => $.shortcuts.reset_action, { action: label })}
- title={t(($) => $.shortcuts.reset)}
+ label={t(($) => $.shortcuts.reset_action, { action: label })}
>
<RotateCcw className="size-3.5" />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
type="button"
variant="ghost"
size="icon-sm"
onClick={onDisable}
disabled={shortcut === null}
- aria-label={t(($) => $.shortcuts.disable_action, { action: label })}
- title={t(($) => $.shortcuts.disable)}
+ label={t(($) => $.shortcuts.disable_action, { action: label })}
>
<X className="size-3.5" />
- </Button>
+ </IconButton>
</div>
{errorText ? (
<span role="alert" className="max-w-72 text-right text-caption text-destructive">
diff --git a/packages/views/settings/components/lark-tab.tsx b/packages/views/settings/components/lark-tab.tsx
index d8e2c73fa1..b7f0e523eb 100644
--- a/packages/views/settings/components/lark-tab.tsx
+++ b/packages/views/settings/components/lark-tab.tsx
@@ -43,6 +43,7 @@ import type { LarkInstallation, LarkInstallStatusResponse } from "@multica/core/
import { ActorAvatar } from "../../common/actor-avatar";
import { docsLocalePrefix } from "../../common/docs-locale";
import { useLocale, useT } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
// MUL-3083: the Lark (international, open.larksuite.com) "connect a Bot"
// entry is temporarily hidden while its install → inbound pipeline is
@@ -394,40 +395,46 @@ export function LarkAgentBindButton({
className={cn("flex flex-wrap items-center gap-2", className)}
data-testid="lark-agent-bind-buttons"
>
- <Button
- variant="outline"
- size="sm"
- onClick={() => setDialogRegion("feishu")}
- disabled={!agentId}
- title={
+ <TooltipHint
+ label={
agentName
? t(($) => $.lark.bind_button_feishu_title, { agent: agentName })
: undefined
}
- data-testid="lark-agent-bind-feishu"
>
- <ExternalLink className="h-3 w-3" />
- {t(($) => $.lark.bind_button_feishu)}
- </Button>
- {/* MUL-3083: Lark (international) bind entry is temporarily hidden —
- see LARK_INTL_CONNECT_ENABLED. Mainland Feishu (above) is
- unaffected. */}
- {LARK_INTL_CONNECT_ENABLED && (
<Button
variant="outline"
size="sm"
- onClick={() => setDialogRegion("lark")}
+ onClick={() => setDialogRegion("feishu")}
disabled={!agentId}
- title={
+ data-testid="lark-agent-bind-feishu"
+ >
+ <ExternalLink className="h-3 w-3" />
+ {t(($) => $.lark.bind_button_feishu)}
+ </Button>
+ </TooltipHint>
+ {/* MUL-3083: Lark (international) bind entry is temporarily hidden —
+ see LARK_INTL_CONNECT_ENABLED. Mainland Feishu (above) is
+ unaffected. */}
+ {LARK_INTL_CONNECT_ENABLED && (
+ <TooltipHint
+ label={
agentName
? t(($) => $.lark.bind_button_lark_title, { agent: agentName })
: undefined
}
- data-testid="lark-agent-bind-lark"
>
- <ExternalLink className="h-3 w-3" />
- {t(($) => $.lark.bind_button_lark)}
- </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setDialogRegion("lark")}
+ disabled={!agentId}
+ data-testid="lark-agent-bind-lark"
+ >
+ <ExternalLink className="h-3 w-3" />
+ {t(($) => $.lark.bind_button_lark)}
+ </Button>
+ </TooltipHint>
)}
</div>
{dialogRegion && (
@@ -574,20 +581,21 @@ function LarkAgentBotConnectedBadge({
</span>
<span className="truncate">{t(($) => $.lark.agent_bot_connected_label)}</span>
</span>
- <Button
- variant="destructive"
- size="sm"
- onClick={() => setConfirmOpen(true)}
- disabled={disconnecting}
- title={t(($) => $.lark.agent_bot_disconnect_tooltip)}
- aria-label={t(($) => $.lark.disconnect)}
- data-testid="lark-agent-bot-disconnect"
- >
- <Trash2 className="h-3 w-3" />
- {disconnecting
- ? t(($) => $.lark.disconnecting)
- : t(($) => $.lark.disconnect)}
- </Button>
+ <TooltipHint label={t(($) => $.lark.agent_bot_disconnect_tooltip)}>
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={() => setConfirmOpen(true)}
+ disabled={disconnecting}
+ aria-label={t(($) => $.lark.disconnect)}
+ data-testid="lark-agent-bot-disconnect"
+ >
+ <Trash2 className="h-3 w-3" />
+ {disconnecting
+ ? t(($) => $.lark.disconnecting)
+ : t(($) => $.lark.disconnect)}
+ </Button>
+ </TooltipHint>
</div>
{/* Row 2: secondary "Manage in Lark" link to the Bot's dev-console
diff --git a/packages/views/settings/components/members-tab.tsx b/packages/views/settings/components/members-tab.tsx
index bc65d1b7ce..e631f76c51 100644
--- a/packages/views/settings/components/members-tab.tsx
+++ b/packages/views/settings/components/members-tab.tsx
@@ -28,6 +28,7 @@ import type {
} from "@multica/core/types";
import { Input } from "@multica/ui/components/ui/input";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Label } from "@multica/ui/components/ui/label";
import {
Dialog,
@@ -225,14 +226,14 @@ function MemberRow({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
disabled={busy}
- aria-label={t(($) => $.members.member_actions, { name: member.name })}
+ label={t(($) => $.members.member_actions, { name: member.name })}
>
<MoreHorizontal className="h-4 w-4 text-muted-foreground" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end" className="w-auto">
@@ -329,17 +330,17 @@ function InvitationRow({
<span className="w-24 shrink-0 text-body">{rc.label}</span>
<span className="flex size-7 shrink-0 items-center justify-center">
{canManage && (
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
disabled={busy}
onClick={onRevoke}
- aria-label={t(($) => $.members.revoke_invitation_aria, {
+ label={t(($) => $.members.revoke_invitation_aria, {
email: invitation.invitee_email,
})}
>
<X className="size-4 text-muted-foreground" />
- </Button>
+ </IconButton>
)}
</span>
</div>
@@ -382,23 +383,23 @@ function ShareLinkRow({
</div>
</div>
<span className="w-24 shrink-0 text-body">{rc.label}</span>
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
onClick={onCopy}
- aria-label={t(($) => $.members.share_link_copy_tooltip)}
+ label={t(($) => $.members.share_link_copy_tooltip)}
>
<Copy className="size-4 text-muted-foreground" />
- </Button>
- <Button
+ </IconButton>
+ <IconButton
variant="ghost"
size="icon-sm"
disabled={busy}
onClick={onRevoke}
- aria-label={t(($) => $.members.share_link_revoke_tooltip)}
+ label={t(($) => $.members.share_link_revoke_tooltip)}
>
<Trash2 className="size-4 text-muted-foreground" />
- </Button>
+ </IconButton>
</div>
);
}
diff --git a/packages/views/settings/components/plugins-tab.tsx b/packages/views/settings/components/plugins-tab.tsx
index b3c421eff0..2bc44c67c6 100644
--- a/packages/views/settings/components/plugins-tab.tsx
+++ b/packages/views/settings/components/plugins-tab.tsx
@@ -26,6 +26,7 @@ import type {
import { Alert, AlertDescription, AlertTitle } from "@multica/ui/components/ui/alert";
import { Badge } from "@multica/ui/components/ui/badge";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import {
Select,
@@ -507,15 +508,15 @@ function PublishedPackage({
<div className="text-body font-medium">{pluginPackage.name}</div>
<p className="text-caption text-muted-foreground">{pluginPackage.plugin_key}</p>
</div>
- <Button
+ <IconButton
size="icon"
variant="ghost"
- aria-label={t(($) => $.plugins.publish.delete)}
+ label={t(($) => $.plugins.publish.delete)}
disabled={!canManage || busy}
onClick={() => onDelete(pluginPackage.id)}
>
<Trash2 />
- </Button>
+ </IconButton>
</div>
<ul className="space-y-1.5">
@@ -610,17 +611,17 @@ function InstalledPlugin({
: t(($) => $.plugins.disabled)))
.catch(reportError)}
/>
- <Button
+ <IconButton
size="icon"
variant="ghost"
- aria-label={t(($) => $.plugins.uninstall)}
+ label={t(($) => $.plugins.uninstall)}
disabled={!canManage || isMutating}
onClick={() => uninstallMutation.mutateAsync(installation.id)
.then(() => toast.success(t(($) => $.plugins.uninstalled)))
.catch(reportError)}
>
{uninstallMutation.isPending ? <Loader2 className="animate-spin" /> : <Trash2 />}
- </Button>
+ </IconButton>
</div>
</div>
diff --git a/packages/views/settings/components/properties-tab.tsx b/packages/views/settings/components/properties-tab.tsx
index 247dd0456c..8d99cd1887 100644
--- a/packages/views/settings/components/properties-tab.tsx
+++ b/packages/views/settings/components/properties-tab.tsx
@@ -29,6 +29,7 @@ import type {
} from "@multica/core/types";
import { ISSUE_PROPERTY_TYPES } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Badge } from "@multica/ui/components/ui/badge";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
@@ -264,13 +265,13 @@ export function PropertiesTab() {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.properties.actions.open, { name: property.name })}
+ label={t(($) => $.properties.actions.open, { name: property.name })}
>
<MoreHorizontal className="size-4" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end">
@@ -606,10 +607,10 @@ function PropertyEditorDialog({
placeholder={t(($) => $.properties.editor.option_name_placeholder)}
className="h-8"
/>
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.properties.editor.remove_option)}
+ label={t(($) => $.properties.editor.remove_option)}
disabled={draft.options.length <= 1}
onClick={() =>
setDraft((current) => ({
@@ -619,7 +620,7 @@ function PropertyEditorDialog({
}
>
<X className="size-4" />
- </Button>
+ </IconButton>
</div>
))}
</div>
diff --git a/packages/views/settings/components/quick-actions-tab.tsx b/packages/views/settings/components/quick-actions-tab.tsx
index 69f42ea750..d32084f334 100644
--- a/packages/views/settings/components/quick-actions-tab.tsx
+++ b/packages/views/settings/components/quick-actions-tab.tsx
@@ -31,6 +31,7 @@ import type {
} from "@multica/core/types";
import { findQuickActionTemplateToken } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Badge } from "@multica/ui/components/ui/badge";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
@@ -341,13 +342,13 @@ export function QuickActionsTab() {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.quick_actions.actions_open, { name: action.name })}
+ label={t(($) => $.quick_actions.actions_open, { name: action.name })}
>
<MoreHorizontal className="size-4" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end">
diff --git a/packages/views/settings/components/repositories-section.tsx b/packages/views/settings/components/repositories-section.tsx
index 9f3e07b6d7..2bf17ade75 100644
--- a/packages/views/settings/components/repositories-section.tsx
+++ b/packages/views/settings/components/repositories-section.tsx
@@ -14,6 +14,7 @@ import {
import { Input } from "@multica/ui/components/ui/input";
import { Label } from "@multica/ui/components/ui/label";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Badge } from "@multica/ui/components/ui/badge";
import { Checkbox } from "@multica/ui/components/ui/checkbox";
import {
@@ -465,10 +466,10 @@ export function RepositoriesSection() {
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
- aria-label={t(($) => $.repositories.actions_aria, {
+ label={t(($) => $.repositories.actions_aria, {
url: repository.url,
})}
/>
diff --git a/packages/views/settings/components/settings-page.tsx b/packages/views/settings/components/settings-page.tsx
index 3a50e71963..e5066ff076 100644
--- a/packages/views/settings/components/settings-page.tsx
+++ b/packages/views/settings/components/settings-page.tsx
@@ -37,6 +37,7 @@ import {
} from "@multica/core/feature-flags";
import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";
import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { cn } from "@multica/ui/lib/utils";
import { resolveSettingsLocation, settingsHref } from "./settings-navigation";
import { AppLink, useNavigation } from "../../navigation";
@@ -501,14 +502,16 @@ export function SettingsPage({ extraDeviceTabs = [] }: SettingsPageProps = {}) {
className="h-8 w-full rounded-lg border border-input bg-transparent pl-8 pr-8 text-body outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-input/30 [&::-webkit-search-cancel-button]:hidden"
/>
{query ? (
- <button
- type="button"
- onClick={() => setQuery("")}
- aria-label={t(($) => $.page.search_clear)}
- className="absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-hover hover:text-foreground"
- >
- <X className="size-3.5" aria-hidden="true" />
- </button>
+ <TooltipHint label={t(($) => $.page.search_clear)}>
+ <button
+ type="button"
+ onClick={() => setQuery("")}
+ aria-label={t(($) => $.page.search_clear)}
+ className="absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-hover hover:text-foreground"
+ >
+ <X className="size-3.5" aria-hidden="true" />
+ </button>
+ </TooltipHint>
) : null}
</div>
<nav
diff --git a/packages/views/settings/components/slack-tab.tsx b/packages/views/settings/components/slack-tab.tsx
index d9790519bd..530cf9b407 100644
--- a/packages/views/settings/components/slack-tab.tsx
+++ b/packages/views/settings/components/slack-tab.tsx
@@ -38,6 +38,7 @@ import { ActorAvatar } from "../../common/actor-avatar";
import { docsLocalePrefix } from "../../common/docs-locale";
import { openExternal } from "../../platform";
import { useLocale, useT } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
// SlackTab is the workspace settings panel for Slack bot installations.
// Listing is member-visible; the disconnect action is admin-only (the backend
@@ -351,21 +352,24 @@ export function SlackAgentBindButton({
className={cn("flex flex-wrap items-center gap-2", className)}
data-testid="slack-agent-bind-buttons"
>
- <Button
- variant="outline"
- size="sm"
- onClick={() => setDialogOpen(true)}
- disabled={!agentId}
- title={
+ <TooltipHint
+ label={
agentName
? t(($) => $.slack.bind_button_title, { agent: agentName })
: undefined
}
- data-testid="slack-agent-connect"
>
- <SlackMark className="h-3 w-3" />
- {t(($) => $.slack.bind_button)}
- </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setDialogOpen(true)}
+ disabled={!agentId}
+ data-testid="slack-agent-connect"
+ >
+ <SlackMark className="h-3 w-3" />
+ {t(($) => $.slack.bind_button)}
+ </Button>
+ </TooltipHint>
<Dialog
open={dialogOpen}
@@ -534,34 +538,36 @@ function SlackAgentBotConnectedBadge({
<span className="inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500" />
<span className="truncate">{t(($) => $.slack.agent_bot_connected_label)}</span>
</span>
- <Button
- variant="destructive"
- size="sm"
- onClick={() => setConfirmOpen(true)}
- disabled={disconnecting}
- title={t(($) => $.slack.agent_bot_disconnect_tooltip)}
- aria-label={t(($) => $.slack.disconnect)}
- data-testid="slack-agent-bot-disconnect"
- >
- <Trash2 className="h-3 w-3" />
- {disconnecting
- ? t(($) => $.slack.disconnecting)
- : t(($) => $.slack.disconnect)}
- </Button>
+ <TooltipHint label={t(($) => $.slack.agent_bot_disconnect_tooltip)}>
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={() => setConfirmOpen(true)}
+ disabled={disconnecting}
+ aria-label={t(($) => $.slack.disconnect)}
+ data-testid="slack-agent-bot-disconnect"
+ >
+ <Trash2 className="h-3 w-3" />
+ {disconnecting
+ ? t(($) => $.slack.disconnecting)
+ : t(($) => $.slack.disconnect)}
+ </Button>
+ </TooltipHint>
</div>
{installation.team_id && (
- <button
- type="button"
- onClick={() =>
- openExternal(`https://app.slack.com/client/${installation.team_id}`)
- }
- className="inline-flex items-center gap-1 text-caption text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline"
- title={t(($) => $.slack.agent_bot_manage_tooltip)}
- >
- <ExternalLink className="h-3 w-3" />
- {t(($) => $.slack.agent_bot_manage_link)}
- </button>
+ <TooltipHint label={t(($) => $.slack.agent_bot_manage_tooltip)}>
+ <button
+ type="button"
+ onClick={() =>
+ openExternal(`https://app.slack.com/client/${installation.team_id}`)
+ }
+ className="inline-flex items-center gap-1 text-caption text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline"
+ >
+ <ExternalLink className="h-3 w-3" />
+ {t(($) => $.slack.agent_bot_manage_link)}
+ </button>
+ </TooltipHint>
)}
<AlertDialog
diff --git a/packages/views/settings/components/telegram-tab.tsx b/packages/views/settings/components/telegram-tab.tsx
index 08a19ff674..cd047e60ce 100644
--- a/packages/views/settings/components/telegram-tab.tsx
+++ b/packages/views/settings/components/telegram-tab.tsx
@@ -38,6 +38,7 @@ import { ActorAvatar } from "../../common/actor-avatar";
import { docsLocalePrefix } from "../../common/docs-locale";
import { openExternal } from "../../platform";
import { useLocale, useT } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
// TelegramTab is the workspace settings panel for Telegram bot installations,
// mirroring SlackTab: listing is member-visible; the disconnect action is
@@ -334,21 +335,24 @@ export function TelegramAgentBindButton({
className={cn("flex flex-wrap items-center gap-2", className)}
data-testid="telegram-agent-bind-buttons"
>
- <Button
- variant="outline"
- size="sm"
- onClick={() => setDialogOpen(true)}
- disabled={!agentId}
- title={
+ <TooltipHint
+ label={
agentName
? t(($) => $.telegram.bind_button_title, { agent: agentName })
: undefined
}
- data-testid="telegram-agent-connect"
>
- <TelegramMark className="h-3 w-3" />
- {t(($) => $.telegram.bind_button)}
- </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setDialogOpen(true)}
+ disabled={!agentId}
+ data-testid="telegram-agent-connect"
+ >
+ <TelegramMark className="h-3 w-3" />
+ {t(($) => $.telegram.bind_button)}
+ </Button>
+ </TooltipHint>
<Dialog
open={dialogOpen}
@@ -491,32 +495,34 @@ function TelegramAgentBotConnectedBadge({
{installation.bot_username ? ` · @${installation.bot_username}` : ""}
</span>
</span>
- <Button
- variant="destructive"
- size="sm"
- onClick={() => setConfirmOpen(true)}
- disabled={disconnecting}
- title={t(($) => $.telegram.agent_bot_disconnect_tooltip)}
- aria-label={t(($) => $.telegram.disconnect)}
- data-testid="telegram-agent-bot-disconnect"
- >
- <Trash2 className="h-3 w-3" />
- {disconnecting
- ? t(($) => $.telegram.disconnecting)
- : t(($) => $.telegram.disconnect)}
- </Button>
+ <TooltipHint label={t(($) => $.telegram.agent_bot_disconnect_tooltip)}>
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={() => setConfirmOpen(true)}
+ disabled={disconnecting}
+ aria-label={t(($) => $.telegram.disconnect)}
+ data-testid="telegram-agent-bot-disconnect"
+ >
+ <Trash2 className="h-3 w-3" />
+ {disconnecting
+ ? t(($) => $.telegram.disconnecting)
+ : t(($) => $.telegram.disconnect)}
+ </Button>
+ </TooltipHint>
</div>
{installation.bot_username && (
- <button
- type="button"
- onClick={() => openExternal(`https://t.me/${installation.bot_username}`)}
- className="inline-flex items-center gap-1 text-caption text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline"
- title={t(($) => $.telegram.agent_bot_manage_tooltip)}
- >
- <ExternalLink className="h-3 w-3" />
- {t(($) => $.telegram.agent_bot_manage_link)}
- </button>
+ <TooltipHint label={t(($) => $.telegram.agent_bot_manage_tooltip)}>
+ <button
+ type="button"
+ onClick={() => openExternal(`https://t.me/${installation.bot_username}`)}
+ className="inline-flex items-center gap-1 text-caption text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline"
+ >
+ <ExternalLink className="h-3 w-3" />
+ {t(($) => $.telegram.agent_bot_manage_link)}
+ </button>
+ </TooltipHint>
)}
<AlertDialog
diff --git a/packages/views/settings/components/wecom-tab.tsx b/packages/views/settings/components/wecom-tab.tsx
index 72631433e1..7eaa51fa78 100644
--- a/packages/views/settings/components/wecom-tab.tsx
+++ b/packages/views/settings/components/wecom-tab.tsx
@@ -37,6 +37,7 @@ import { api } from "@multica/core/api";
import type { WecomInstallation } from "@multica/core/types";
import { ActorAvatar } from "../../common/actor-avatar";
import { useT } from "../../i18n";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
// WecomTab is the workspace settings panel for WeCom smart-bot
// installations. Listing is member-visible; the disconnect action is
@@ -363,21 +364,24 @@ export function WecomAgentBindButton({
className={cn("flex flex-wrap items-center gap-2", className)}
data-testid="wecom-agent-bind-buttons"
>
- <Button
- variant="outline"
- size="sm"
- onClick={() => setDialogOpen(true)}
- disabled={!agentId}
- title={
+ <TooltipHint
+ label={
agentName
? t(($) => $.wecom.bind_button_title, { agent: agentName })
: undefined
}
- data-testid="wecom-agent-connect"
>
- <WecomMark className="h-3 w-3" />
- {t(($) => $.wecom.bind_button)}
- </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setDialogOpen(true)}
+ disabled={!agentId}
+ data-testid="wecom-agent-connect"
+ >
+ <WecomMark className="h-3 w-3" />
+ {t(($) => $.wecom.bind_button)}
+ </Button>
+ </TooltipHint>
<Dialog
open={dialogOpen}
@@ -538,20 +542,21 @@ function WecomAgentBotConnectedBadge({
})}
</span>
</span>
- <Button
- variant="destructive"
- size="sm"
- onClick={() => setConfirmOpen(true)}
- disabled={disconnecting}
- title={t(($) => $.wecom.agent_bot_disconnect_tooltip)}
- aria-label={t(($) => $.wecom.disconnect)}
- data-testid="wecom-agent-bot-disconnect"
- >
- <Trash2 className="h-3 w-3" />
- {disconnecting
- ? t(($) => $.wecom.disconnecting)
- : t(($) => $.wecom.disconnect)}
- </Button>
+ <TooltipHint label={t(($) => $.wecom.agent_bot_disconnect_tooltip)}>
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={() => setConfirmOpen(true)}
+ disabled={disconnecting}
+ aria-label={t(($) => $.wecom.disconnect)}
+ data-testid="wecom-agent-bot-disconnect"
+ >
+ <Trash2 className="h-3 w-3" />
+ {disconnecting
+ ? t(($) => $.wecom.disconnecting)
+ : t(($) => $.wecom.disconnect)}
+ </Button>
+ </TooltipHint>
</div>
<AlertDialog
diff --git a/packages/views/settings/components/workspace-tab.tsx b/packages/views/settings/components/workspace-tab.tsx
index 0ea4bfd9fb..4824c7fdfd 100644
--- a/packages/views/settings/components/workspace-tab.tsx
+++ b/packages/views/settings/components/workspace-tab.tsx
@@ -5,6 +5,7 @@ import { Copy } from "lucide-react";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import { Label } from "@multica/ui/components/ui/label";
import {
Dialog,
@@ -434,10 +435,10 @@ export function WorkspaceTab() {
>
<span className="flex items-center gap-1">
<code className="font-mono text-label text-foreground">{workspace.slug}</code>
- <Button
+ <IconButton
variant="ghost"
size="icon-xs"
- aria-label={t(($) => $.workspace.copy_slug)}
+ label={t(($) => $.workspace.copy_slug)}
onClick={async () => {
if (!(await copyText(workspace.slug))) {
toast.error(t(($) => $.workspace.copy_failed));
@@ -445,7 +446,7 @@ export function WorkspaceTab() {
}}
>
<Copy />
- </Button>
+ </IconButton>
</span>
</SettingsRow>
diff --git a/packages/views/skills/components/file-tree.tsx b/packages/views/skills/components/file-tree.tsx
index c5fcdf61db..647485fbae 100644
--- a/packages/views/skills/components/file-tree.tsx
+++ b/packages/views/skills/components/file-tree.tsx
@@ -22,6 +22,7 @@ import {
} from "@multica/ui/components/ui/dropdown-menu";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../../i18n";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
/**
* What a row may offer beyond selection. Absent for read-only viewers, so the
@@ -217,32 +218,37 @@ function TreeNodeItem({
</button>
{actions && (
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- ref={menuButtonRef}
- type="button"
- aria-label={t(($) => $.file_tree.actions.label, {
- path: node.path,
- })}
- // Hidden until the row is hovered or something inside it holds
- // focus, so a rail of ten files is not a rail of ten buttons.
- // after:-inset-1 widens the hit area past the 20px glyph.
- //
- // `relative` is load-bearing, not decoration: it makes THIS
- // button the containing block for that ::after. Without it the
- // pseudo-element resolves against the row (the nearest
- // positioned ancestor), so the invisible hit area covered the
- // whole row and — being absolutely positioned, hence painted
- // above the in-flow name button — swallowed every click on the
- // file name. Selecting a supporting file opened this menu
- // instead (MUL-5654). opacity-0 does not opt out of hit
- // testing, so the row was unclickable even before hover.
- className="relative mr-1 shrink-0 rounded-xs p-0.5 text-faint-foreground opacity-0 transition-opacity after:absolute after:-inset-1 hover:text-foreground group-hover/row:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100"
- onClick={(event) => event.stopPropagation()}
- >
- <MoreHorizontal className="h-3.5 w-3.5" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.file_tree.actions.label, { path: node.path })}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ ref={menuButtonRef}
+ type="button"
+ aria-label={t(($) => $.file_tree.actions.label, {
+ path: node.path,
+ })}
+ // Hidden until the row is hovered or something inside it holds
+ // focus, so a rail of ten files is not a rail of ten buttons.
+ // after:-inset-1 widens the hit area past the 20px glyph.
+ //
+ // `relative` is load-bearing, not decoration: it makes THIS
+ // button the containing block for that ::after. Without it the
+ // pseudo-element resolves against the row (the nearest
+ // positioned ancestor), so the invisible hit area covered the
+ // whole row and — being absolutely positioned, hence painted
+ // above the in-flow name button — swallowed every click on the
+ // file name. Selecting a supporting file opened this menu
+ // instead (MUL-5654). opacity-0 does not opt out of hit
+ // testing, so the row was unclickable even before hover.
+ className="relative mr-1 shrink-0 rounded-xs p-0.5 text-faint-foreground opacity-0 transition-opacity after:absolute after:-inset-1 hover:text-foreground group-hover/row:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <MoreHorizontal className="h-3.5 w-3.5" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-36">
diff --git a/packages/views/skills/components/skill-list-actions.tsx b/packages/views/skills/components/skill-list-actions.tsx
index 736eb63811..be5ea44abf 100644
--- a/packages/views/skills/components/skill-list-actions.tsx
+++ b/packages/views/skills/components/skill-list-actions.tsx
@@ -49,12 +49,14 @@ import {
TooltipTrigger,
} from "@multica/ui/components/ui/tooltip";
import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../../i18n";
import { useIntentNavigate } from "../../navigation";
import { isRefreshableOrigin, readOrigin } from "../lib/origin";
import { RefreshSkillDialog } from "./refresh-skill-dialog";
import type { SkillRow } from "./skill-list-filter";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
// Shared context the row kebab and the batch toolbar both need. Assembled
// once at the page level.
@@ -666,15 +668,20 @@ export function SkillRowActions({
className="flex items-center"
>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={t(($) => $.actions.row_menu)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
- >
- <MoreHorizontal className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.actions.row_menu)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.actions.row_menu)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ >
+ <MoreHorizontal className="size-4" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-52">
@@ -803,14 +810,16 @@ export function SkillBatchToolbar({
<span className="text-body font-medium">
{t(($) => $.actions.selected, { count: rows.length })}
</span>
- <button
- type="button"
- aria-label={t(($) => $.actions.clear_selection)}
- onClick={onClear}
- className="rounded-xs p-0.5 transition-colors hover:bg-accent"
- >
- <X className="size-3.5 text-muted-foreground" />
- </button>
+ <TooltipHint label={t(($) => $.actions.clear_selection)}>
+ <button
+ type="button"
+ aria-label={t(($) => $.actions.clear_selection)}
+ onClick={onClear}
+ className="rounded-xs p-0.5 transition-colors hover:bg-accent"
+ >
+ <X className="size-3.5 text-muted-foreground" />
+ </button>
+ </TooltipHint>
</div>
<Button variant="ghost" size="sm" onClick={() => setAddOpen(true)}>
diff --git a/packages/views/skills/components/skill-list-toolbar.tsx b/packages/views/skills/components/skill-list-toolbar.tsx
index 07d926a253..a48e0a194a 100644
--- a/packages/views/skills/components/skill-list-toolbar.tsx
+++ b/packages/views/skills/components/skill-list-toolbar.tsx
@@ -19,6 +19,7 @@ import { labelListOptions } from "@multica/core/labels/queries";
import type { Agent, Label, MemberWithUser } from "@multica/core/types";
import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
DropdownMenu,
DropdownMenuCheckboxItem,
@@ -541,7 +542,7 @@ export function SkillListToolbar({
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
- <Button
+ <IconButton
variant="outline"
size="icon-sm"
onClick={() =>
@@ -549,7 +550,7 @@ export function SkillListToolbar({
sortDirection === "asc" ? "desc" : "asc",
)
}
- title={
+ label={
sortDirection === "asc"
? t(($) => $.toolbar.direction_asc)
: t(($) => $.toolbar.direction_desc)
@@ -560,7 +561,7 @@ export function SkillListToolbar({
) : (
<ArrowDown className="size-3.5" />
)}
- </Button>
+ </IconButton>
</div>
</div>
diff --git a/packages/views/squads/components/squads-page.tsx b/packages/views/squads/components/squads-page.tsx
index f65b28039a..09339f9268 100644
--- a/packages/views/squads/components/squads-page.tsx
+++ b/packages/views/squads/components/squads-page.tsx
@@ -38,6 +38,7 @@ import {
} from "@multica/core/squads/stores";
import type { Agent, MemberWithUser, Squad } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
import {
Dialog,
DialogContent,
@@ -91,6 +92,7 @@ import {
} from "../../layout/collection-page";
import { useLocale, useT } from "../../i18n";
import { PAGE_TOOLBAR } from "../../layout/page-header";
+import { DeferredTooltip } from "@multica/ui/components/common/deferred-tooltip";
// Column template — the simplest member of the ListGrid family (squads are
// the fewest entity, 1-5 rows): subgrid template + var tracks + two-zone
@@ -325,15 +327,20 @@ function SquadRowActions({ squad }: { squad: Squad }) {
className="flex items-center"
>
<DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={t(($) => $.page.row_menu)}
- className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
- >
- <MoreHorizontal className="size-4" />
- </button>
+ <DeferredTooltip
+ content={t(($) => $.page.row_menu)}
+ trigger={
+ <DropdownMenuTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.page.row_menu)}
+ className="flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/row:opacity-100 data-popup-open:bg-accent data-popup-open:opacity-100 data-popup-open:text-accent-foreground"
+ >
+ <MoreHorizontal className="size-4" />
+ </button>
+ }
+ />
}
/>
<DropdownMenuContent align="end" className="w-40">
@@ -711,7 +718,7 @@ function SquadListToolbar({
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
- <Button
+ <IconButton
variant="outline"
size="icon-sm"
onClick={() =>
@@ -719,7 +726,7 @@ function SquadListToolbar({
sortDirection === "asc" ? "desc" : "asc",
)
}
- title={
+ label={
sortDirection === "asc"
? t(($) => $.toolbar.direction_asc)
: t(($) => $.toolbar.direction_desc)
@@ -730,7 +737,7 @@ function SquadListToolbar({
) : (
<ArrowDown className="size-3.5" />
)}
- </Button>
+ </IconButton>
</div>
</div>
<div className="px-3 py-2.5">
diff --git a/packages/views/workflows/workflow-editor-page.tsx b/packages/views/workflows/workflow-editor-page.tsx
index 3f14b2e65f..b686582f5d 100644
--- a/packages/views/workflows/workflow-editor-page.tsx
+++ b/packages/views/workflows/workflow-editor-page.tsx
@@ -56,6 +56,8 @@ import type {
IssueWorkflowStepInput,
} from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
+import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import {
DropdownMenu,
DropdownMenuContent,
@@ -471,9 +473,9 @@ export function WorkflowEditorPage({
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button variant="ghost" size="icon" aria-label={t(($) => $.workflows.editor.more)}>
+ <IconButton variant="ghost" size="icon" label={t(($) => $.workflows.editor.more)} tooltipSide="bottom">
<MoreHorizontal className="size-4" />
- </Button>
+ </IconButton>
}
/>
<DropdownMenuContent align="end" className="w-56">
@@ -719,14 +721,16 @@ function StepCard({
)}
>
{sortable?.handle ? (
- <button
- type="button"
- aria-label={t(($) => $.workflows.editor.reorder, { name: label })}
- className="flex h-5 w-4 shrink-0 touch-none items-center justify-center rounded-xs cursor-grab text-muted-foreground active:cursor-grabbing"
- {...sortable.handle}
- >
- <GripVertical className="size-3.5" />
- </button>
+ <TooltipHint label={t(($) => $.workflows.editor.reorder, { name: label })}>
+ <button
+ type="button"
+ aria-label={t(($) => $.workflows.editor.reorder, { name: label })}
+ className="flex h-5 w-4 shrink-0 touch-none items-center justify-center rounded-xs cursor-grab text-muted-foreground active:cursor-grabbing"
+ {...sortable.handle}
+ >
+ <GripVertical className="size-3.5" />
+ </button>
+ </TooltipHint>
) : (
<span className="h-5 w-4 shrink-0" />
)}
@@ -854,15 +858,15 @@ function StepDetail({
<Badge>{t(($) => $.workflows.editor.new_badge)}</Badge>
)}
{onRemove && (
- <Button
+ <IconButton
variant="ghost"
size="icon-sm"
className="ml-auto text-muted-foreground"
- aria-label={t(($) => $.workflows.editor.remove)}
+ label={t(($) => $.workflows.editor.remove)}
onClick={onRemove}
>
<Trash2 className="size-3.5" />
- </Button>
+ </IconButton>
)}
</header>
<div className="space-y-6 p-5">