Tooltip subtlety round: 500ms rest delay, quiet chip, parens suffixes, drops + trims
Owner round 2026-09-25, over 09c0f6e. The wave's tooltips read as distracting; this round makes them quiet: - Delay: TOOLTIP_DELAY_MS = 500 in the primitive — tooltips appear when you pause on a control, never in passing (Radix focus-opens stay instant by design; keyboard users don't wait). - Vanish on leave: disableHoverableContent — the chip is un-hoverable, so the instant the cursor leaves the trigger it's gone, even mid-move onto the chip's own pixels. - Look: bg-accent (#2a2a2a, the hover-chip tone) instead of the white bg-foreground slab; 11px; px-2 py-1; arrow culled (nothing purely decorative); text-foreground/85. - Suffix: parentheses, not em-dash — "Dictate (⌘D)"; the registry source unchanged (still override-aware). - Drops (owner-selected): send square, start square, stats summary — the icons/numbers describe themselves. - Home logo kept but to the RIGHT with its real shortcut "Home (⌘G)" (jump-graph routes to /, the same destination). - Trims: "Model selector (⌘K)", "Thinking level", "Graph costs — click for details", "How much of this session isn't mapped yet". - Added: Import Notes gets "Import notes into the graph" — the one button whose destination wasn't obvious. Pins: TOOLTIP_DELAY_MS=500; hintText parens expectations updated. Live-verified on :3001 — 508ms hover delay measured, close within 10ms of pointerout, chip styles probed (rgb(42,42,42), 11px, 4px/8px), arrow gone, all new labels + sides confirmed, drops carry no tooltip and no aria-describedby.
This commit is contained in:
+7
-13
@@ -133,18 +133,13 @@ export function Composer({
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<Hint
|
||||
// Per-state truth (tooltip wave): busy → the square STOPS the
|
||||
// stream, and Esc aborts it too; otherwise Enter sends when the
|
||||
// box has text.
|
||||
label={busy ? "Stop the reply" : "Send"}
|
||||
binding={busy ? "escape" : "enter"}
|
||||
side="left"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
aria-label={busy ? "Stop" : "Send"}
|
||||
disabled={!busy && !canSend}
|
||||
// No tooltip on the send square — the ↵ glyph is the
|
||||
// affordance and Enter is obvious (owner, subtlety
|
||||
// round 2026-09-25).
|
||||
<button
|
||||
type="submit"
|
||||
aria-label={busy ? "Stop" : "Send"}
|
||||
disabled={!busy && !canSend}
|
||||
className={cn(
|
||||
"flex size-10 shrink-0 items-center justify-center rounded-[10px] transition-colors",
|
||||
busy
|
||||
@@ -154,7 +149,6 @@ export function Composer({
|
||||
>
|
||||
{busy ? <SquareIcon className="size-4" /> : <CornerDownLeftIcon className="size-5" />}
|
||||
</button>
|
||||
</Hint>
|
||||
)}
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -292,9 +292,8 @@ export function CoverageRing({ chatId, refreshKey = 0 }: { chatId: string; refre
|
||||
return (
|
||||
<div ref={rootRef} className="lh-no-drag relative shrink-0">
|
||||
<Hint
|
||||
// Plain language (tooltip wave) — "uncovered tokens vs the chunk
|
||||
// threshold" was internal vocabulary.
|
||||
label="How much of this session isn't in your graph yet — click for details"
|
||||
// Trimmed (owner, subtlety round 2026-09-25).
|
||||
label="How much of this session isn't mapped yet"
|
||||
side="bottom"
|
||||
>
|
||||
<button
|
||||
|
||||
+18
-10
@@ -328,8 +328,8 @@ function GraphCostControl({ costs }: { costs: GraphCostSummary }) {
|
||||
return (
|
||||
<div ref={rootRef} className="relative">
|
||||
<Hint
|
||||
// Plain language (tooltip wave) — no internal vocabulary.
|
||||
label="What the graph has spent — click for details"
|
||||
// Trimmed (owner, subtlety round 2026-09-25).
|
||||
label="Graph costs — click for details"
|
||||
side="bottom"
|
||||
>
|
||||
<button
|
||||
@@ -884,16 +884,24 @@ export function GraphChromeRow({
|
||||
e.target.value = ""; // allow re-picking the same file
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
disabled={importing}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
data-testid="import-notes"
|
||||
<Hint
|
||||
// The one button whose action isn't obvious from its label:
|
||||
// the missing fact is where imports go (owner, subtlety
|
||||
// round 2026-09-25).
|
||||
label="Import notes into the graph"
|
||||
side="bottom"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
disabled={importing}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
data-testid="import-notes"
|
||||
className="flex h-7 items-center gap-1.5 rounded-lg px-2.5 text-xs text-muted-foreground transition-colors hover:bg-accent disabled:opacity-50"
|
||||
>
|
||||
<UploadIcon className="size-3" />
|
||||
{importing ? "Importing…" : "Import notes…"}
|
||||
</button>
|
||||
<UploadIcon className="size-3" />
|
||||
{importing ? "Importing…" : "Import notes…"}
|
||||
</button>
|
||||
</Hint>
|
||||
</div>
|
||||
{!isEmpty && (
|
||||
// Rendering settings — own component; the gear toggles it. The
|
||||
|
||||
+4
-10
@@ -5,7 +5,6 @@ import { useRouter } from "next/navigation";
|
||||
import { CornerDownLeftIcon } from "lucide-react";
|
||||
import { GraphView } from "@/components/graph-view";
|
||||
import { SetupDialog } from "@/components/setup-dialog";
|
||||
import { Hint } from "@/components/ui/hint";
|
||||
import { useStrongKeyless, useZeroKeys, ZeroKeysPill } from "@/components/setup-cta";
|
||||
import { useDefaultSettings } from "@/components/default-settings";
|
||||
import { DictationBar, useDictation } from "@/components/dictation";
|
||||
@@ -177,21 +176,16 @@ export function Home({ initialSettings, initialConfigured }: { initialSettings:
|
||||
rows={1}
|
||||
className="field-sizing-content lh-input max-h-48 min-h-10 flex-1 resize-none bg-transparent px-2.5 py-2 outline-none placeholder:text-muted-foreground"
|
||||
/>
|
||||
<Hint
|
||||
// Enter starts the session too (the form submits).
|
||||
label="Start session"
|
||||
binding="enter"
|
||||
side="left"
|
||||
>
|
||||
<button
|
||||
{/* No tooltip on the start square — the ↵ glyph is the
|
||||
affordance (owner, subtlety round 2026-09-25). */}
|
||||
<button
|
||||
type="submit"
|
||||
aria-label="Start session"
|
||||
disabled={!topic.trim() || busy}
|
||||
className="flex size-10 shrink-0 items-center justify-center rounded-[10px] bg-primary text-primary-foreground transition-colors hover:opacity-90 disabled:opacity-40"
|
||||
>
|
||||
<CornerDownLeftIcon className="size-5" />
|
||||
</button>
|
||||
</Hint>
|
||||
</button>
|
||||
</form>
|
||||
{/* Same as the chat view's under-composer stats bar (owner) — no
|
||||
session yet, so the LEFT side renders nothing (wave 7 sweep)
|
||||
|
||||
@@ -254,9 +254,10 @@ export function ModelControl() {
|
||||
return (
|
||||
<div ref={containerRef} className="relative flex items-center gap-1.5" data-testid="model-control">
|
||||
<Hint
|
||||
// User language (tooltip wave): no tier/prober vocabulary. ⌘K
|
||||
// opens this same menu (registry, override-aware).
|
||||
label="The main model for your sessions"
|
||||
// Trimmed (owner, subtlety round 2026-09-25): "Model selector"
|
||||
// — the long sentence was way too much. ⌘K opens this same
|
||||
// menu (registry, override-aware).
|
||||
label="Model selector"
|
||||
action="open-model-picker"
|
||||
side="bottom"
|
||||
>
|
||||
@@ -276,8 +277,8 @@ export function ModelControl() {
|
||||
</button>
|
||||
</Hint>
|
||||
<Hint
|
||||
// User language (tooltip wave) — no "tier" vocabulary.
|
||||
label="How much the main model thinks"
|
||||
// Trimmed (owner, subtlety round 2026-09-25).
|
||||
label="Thinking level"
|
||||
side="bottom"
|
||||
>
|
||||
<button
|
||||
|
||||
@@ -544,7 +544,15 @@ function SessionsSidebar() {
|
||||
with the lights' own edge-inset as the gap. */}
|
||||
{/* Hover mirrors the ghost toggle buttons (owner ask, 2026-09-17):
|
||||
same size-9 chip geometry, same hover:bg-accent treatment. */}
|
||||
<Hint label="Home" side="bottom">
|
||||
<Hint
|
||||
// Kept (owner, subtlety round 2026-09-25) but to the RIGHT
|
||||
// of the logo, carrying its real shortcut: ⌘G jumps to
|
||||
// the graph view (keyboard-shortcuts routes it to "/",
|
||||
// the same destination as this logo).
|
||||
label="Home"
|
||||
action="jump-graph"
|
||||
side="right"
|
||||
>
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="Home"
|
||||
|
||||
+15
-21
@@ -4,7 +4,6 @@ import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import { contextWindow, sessionCost, turnCost, type ChatSettings, type TurnUsage } from "@/src/core";
|
||||
import { formatTokens, formatUsd, prettyModel } from "@/components/usage-format";
|
||||
import { ModelControl, catalogLimits, useModelCatalog } from "@/components/model-picker";
|
||||
import { Hint } from "@/components/ui/hint";
|
||||
|
||||
/**
|
||||
* The below-composer stats bar (wave 4 observability): the session's
|
||||
@@ -93,26 +92,21 @@ export function StatsBar({
|
||||
exists (turns). Pre-chat renders nothing (see the header). */}
|
||||
{turns.length > 0 && (
|
||||
<div ref={barRef} className="relative">
|
||||
<Hint
|
||||
// Copy kept (the scout approved) — machinery moved to the
|
||||
// styled tooltip (tooltip wave).
|
||||
label="Session stats — per-turn detail"
|
||||
side="bottom"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
aria-expanded={open}
|
||||
data-testid="stats-summary"
|
||||
className="flex items-center gap-1.5 tabular-nums transition-colors hover:text-foreground"
|
||||
>
|
||||
<span data-testid="stats-context">
|
||||
{ctx ? (ctx.limit !== null ? `${formatTokens(ctx.usedTokens)} / ${formatTokens(ctx.limit)}` : formatTokens(ctx.usedTokens)) : "—"}
|
||||
</span>
|
||||
<span aria-hidden>·</span>
|
||||
<span data-testid="stats-cost">{costLabel}</span>
|
||||
</button>
|
||||
</Hint>
|
||||
{/* No tooltip — the numbers describe themselves and the popover
|
||||
speaks on click (owner, subtlety round 2026-09-25). */}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
aria-expanded={open}
|
||||
data-testid="stats-summary"
|
||||
className="flex items-center gap-1.5 tabular-nums transition-colors hover:text-foreground"
|
||||
>
|
||||
<span data-testid="stats-context">
|
||||
{ctx ? (ctx.limit !== null ? `${formatTokens(ctx.usedTokens)} / ${formatTokens(ctx.limit)}` : formatTokens(ctx.usedTokens)) : "—"}
|
||||
</span>
|
||||
<span aria-hidden>·</span>
|
||||
<span data-testid="stats-cost">{costLabel}</span>
|
||||
</button>
|
||||
{open && (
|
||||
<div
|
||||
data-testid="stats-detail"
|
||||
|
||||
@@ -6,9 +6,10 @@ import { bindingForAction, formatBinding, type KeyAction } from "@/src/core"
|
||||
|
||||
/**
|
||||
* The tooltip composition for icon and pill controls (tooltip wave, owner
|
||||
* 2026-09-25). The styled Radix tooltip (ui/tooltip.tsx, adopted as-is —
|
||||
* no restyling) carries the label, with the control's shortcut appended as
|
||||
* an em-dash suffix when it has one ("Dictate — ⌘D").
|
||||
* 2026-09-25; subtlety round same day). The styled Radix tooltip carries
|
||||
* the label, with the control's shortcut appended in parentheses when
|
||||
* it has one ("Dictate (⌘D)") — the owner call: the em-dash suffix read
|
||||
* as too much air.
|
||||
*
|
||||
* The binding is override-aware: pass `action` for registry shortcuts (a
|
||||
* user rebind in Settings → Keyboard changes the suffix live), or
|
||||
@@ -31,7 +32,7 @@ interface HintProps {
|
||||
children: React.ReactElement
|
||||
}
|
||||
|
||||
/** The composition itself, pure — "Dictate" + ⌘D → "Dictate — ⌘D". Exported
|
||||
/** The composition itself, pure — "Dictate" + ⌘D → "Dictate (⌘D)". Exported
|
||||
* for the mechanism pins (tests/tooltip-mechanism.test.tsx). */
|
||||
export function hintText(label: string, action?: KeyAction, binding?: string): string {
|
||||
const live = action
|
||||
@@ -39,7 +40,7 @@ export function hintText(label: string, action?: KeyAction, binding?: string): s
|
||||
: binding
|
||||
? formatBinding(binding)
|
||||
: ""
|
||||
return live ? `${label} — ${live}` : label
|
||||
return live ? `${label} (${live})` : label
|
||||
}
|
||||
|
||||
export function Hint({ label, action, binding, side = "top", children }: HintProps) {
|
||||
|
||||
@@ -5,8 +5,21 @@ import { Tooltip as TooltipPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
/**
|
||||
* The styled tooltip (tooltip wave → subtlety round, owner 2026-09-25):
|
||||
* a quiet dark chip, not a white slab — accent tone (the hover-chip color),
|
||||
* 11px, minimal padding, no arrow (nothing purely decorative). Opens after
|
||||
* a 500ms rest, so tooltips appear when you pause on a control, never in
|
||||
* passing; disableHoverableContent means the chip is un-hoverable — the
|
||||
* instant the cursor leaves the trigger it's gone, even mid-move onto the
|
||||
* chip's own pixels.
|
||||
*/
|
||||
|
||||
/** The rest delay (ms): shared by hover and focus opens. */
|
||||
export const TOOLTIP_DELAY_MS = 500
|
||||
|
||||
function TooltipProvider({
|
||||
delayDuration = 0,
|
||||
delayDuration = TOOLTIP_DELAY_MS,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
||||
return (
|
||||
@@ -19,9 +32,16 @@ function TooltipProvider({
|
||||
}
|
||||
|
||||
function Tooltip({
|
||||
disableHoverableContent = true,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||
return (
|
||||
<TooltipPrimitive.Root
|
||||
data-slot="tooltip"
|
||||
disableHoverableContent={disableHoverableContent}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TooltipTrigger({
|
||||
@@ -32,7 +52,7 @@ function TooltipTrigger({
|
||||
|
||||
function TooltipContent({
|
||||
className,
|
||||
sideOffset = 0,
|
||||
sideOffset = 6,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||
@@ -42,16 +62,15 @@ function TooltipContent({
|
||||
data-slot="tooltip-content"
|
||||
sideOffset={sideOffset}
|
||||
className={cn(
|
||||
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
||||
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-accent px-2 py-1 text-[11px] text-foreground/85 text-balance fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
||||
</TooltipPrimitive.Content>
|
||||
</TooltipPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||
Reference in New Issue
Block a user