Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(chat): replace native title hints with shared tooltips (#1526)

Bingxi Zhao (Frank)ccf1129dea1d
diff --git a/web/components/chat/MyAgentsPicker.tsx b/web/components/chat/MyAgentsPicker.tsx
index f3befef23..59fc1482c 100644
--- a/web/components/chat/MyAgentsPicker.tsx
+++ b/web/components/chat/MyAgentsPicker.tsx
@@ -33,6 +33,7 @@ import {
} from "@/lib/chat-import/attribution";
import { normalizeMessageContent, truncateText } from "@/lib/message-content";
import { displaySessionTitle } from "@/lib/session-title";
+import Tooltip from "@/shared/ui/Tooltip";
interface MyAgentsPickerProps {
open: boolean;
@@ -492,15 +493,16 @@ export default function MyAgentsPicker({
</div>
</div>
</button>
- <button
- type="button"
- onClick={() => void openPreview(row)}
- title={t("Preview")}
- aria-label={t("Preview")}
- className="mr-3 mt-3 shrink-0 rounded-lg border border-transparent p-1.5 text-[var(--muted-foreground)] opacity-0 transition-all hover:border-[var(--border)] hover:text-[var(--foreground)] focus:opacity-100 group-hover/row:opacity-100"
- >
- <Eye size={15} />
- </button>
+ <Tooltip label={t("Preview")} side="top">
+ <button
+ type="button"
+ onClick={() => void openPreview(row)}
+ aria-label={t("Preview")}
+ className="mr-3 mt-3 shrink-0 rounded-lg border border-transparent p-1.5 text-[var(--muted-foreground)] opacity-0 transition-all hover:border-[var(--border)] hover:text-[var(--foreground)] focus:opacity-100 group-hover/row:opacity-100"
+ >
+ <Eye size={15} />
+ </button>
+ </Tooltip>
</div>
);
})}
diff --git a/web/components/chat/home/ChatComposer.tsx b/web/components/chat/home/ChatComposer.tsx
index 598243c75..073f83f20 100644
--- a/web/components/chat/home/ChatComposer.tsx
+++ b/web/components/chat/home/ChatComposer.tsx
@@ -90,6 +90,7 @@ import { useVoiceRecorder } from "@/hooks/useVoiceRecorder";
import type { CapabilityDef } from "@/features/capabilities/presentation";
import AttachmentProcessingStatus from "./AttachmentProcessingStatus";
import type { AttachmentProcessingItem } from "@/features/chat/selectors/attachment-processing";
+import Tooltip from "@/shared/ui/Tooltip";
interface PendingAttachment {
type: string;
@@ -1093,25 +1094,26 @@ export default memo(function ChatComposer({
<div className={styles.context}>
{showCapabilityChip && (
<div className="relative min-w-0 max-w-full">
- <button
- ref={capBtnRef}
- aria-haspopup="menu"
- aria-expanded={capMenuOpen}
- onClick={() => onSetCapMenuOpen((v) => !v)}
- aria-label={t(activeCap.label)}
- title={t(activeCap.label)}
- className={`inline-flex h-8 max-w-full items-center rounded-lg px-2 text-[14px] font-medium transition-[background-color,color,transform] duration-150 active:scale-[0.97] ${
- capMenuOpen
- ? "bg-[var(--primary)]/10 text-[var(--primary)]"
- : "text-[var(--foreground)] hover:bg-[var(--muted)]/55"
- }`}
- >
- <CapIcon size={16} strokeWidth={1.7} className="shrink-0" />
- <span className="ml-1.5 inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap">
- <span className="min-w-0 truncate">{t(activeCap.label)}</span>
- <ChevronDown size={13} strokeWidth={2} className={`shrink-0 transition-transform duration-200 ${capMenuOpen ? "rotate-180" : ""}`} />
- </span>
- </button>
+ <Tooltip label={t(activeCap.label)} suppressed={capMenuOpen} side="top">
+ <button
+ ref={capBtnRef}
+ aria-haspopup="menu"
+ aria-expanded={capMenuOpen}
+ onClick={() => onSetCapMenuOpen((v) => !v)}
+ aria-label={t(activeCap.label)}
+ className={`inline-flex h-8 max-w-full items-center rounded-lg px-2 text-[14px] font-medium transition-[background-color,color,transform] duration-150 active:scale-[0.97] ${
+ capMenuOpen
+ ? "bg-[var(--primary)]/10 text-[var(--primary)]"
+ : "text-[var(--foreground)] hover:bg-[var(--muted)]/55"
+ }`}
+ >
+ <CapIcon size={16} strokeWidth={1.7} className="shrink-0" />
+ <span className="ml-1.5 inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap">
+ <span className="min-w-0 truncate">{t(activeCap.label)}</span>
+ <ChevronDown size={13} strokeWidth={2} className={`shrink-0 transition-transform duration-200 ${capMenuOpen ? "rotate-180" : ""}`} />
+ </span>
+ </button>
+ </Tooltip>
{capMenuOpen && (
<div
@@ -1303,40 +1305,36 @@ export default memo(function ChatComposer({
{contextBudget ? <ContextBudgetChip budget={contextBudget} /> : null}
- <button
- type="button"
- onClick={recorder.toggle}
- disabled={recorder.state === "transcribing" || isStreaming}
- className={`group relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] transition-[background-color,color,transform] duration-150 active:scale-90 disabled:opacity-40 ${
- recorder.state === "recording"
- ? "bg-red-500/15 text-red-500"
- : "text-[var(--muted-foreground)] hover:bg-[var(--muted)]/55 hover:text-[var(--foreground)]"
- }`}
- aria-label={
- recorder.state === "recording"
- ? t("Stop recording")
- : t("Record voice")
- }
- title={
- recorder.error ||
- (recorder.state === "recording"
- ? t("Stop recording")
- : t("Record voice"))
- }
+ <Tooltip
+ label={recorder.state === "recording" ? t("Stop recording") : t("Record voice")}
+ description={recorder.error || undefined}
+ side="top"
>
- {recorder.state === "recording" && (
- <span className="pointer-events-none absolute inset-0 rounded-[10px] border border-red-500/40 animate-pulse" />
- )}
- {recorder.state === "transcribing" ? (
- <Loader2
- size={16}
- strokeWidth={1.9}
- className="animate-spin"
- />
- ) : (
- <Mic size={16} strokeWidth={1.9} />
- )}
- </button>
+ <button
+ type="button"
+ onClick={recorder.toggle}
+ disabled={recorder.state === "transcribing" || isStreaming}
+ className={`group relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] transition-[background-color,color,transform] duration-150 active:scale-90 disabled:opacity-40 ${
+ recorder.state === "recording"
+ ? "bg-red-500/15 text-red-500"
+ : "text-[var(--muted-foreground)] hover:bg-[var(--muted)]/55 hover:text-[var(--foreground)]"
+ }`}
+ aria-label={recorder.state === "recording" ? t("Stop recording") : t("Record voice")}
+ >
+ {recorder.state === "recording" && (
+ <span className="pointer-events-none absolute inset-0 rounded-[10px] border border-red-500/40 animate-pulse" />
+ )}
+ {recorder.state === "transcribing" ? (
+ <Loader2
+ size={16}
+ strokeWidth={1.9}
+ className="animate-spin"
+ />
+ ) : (
+ <Mic size={16} strokeWidth={1.9} />
+ )}
+ </button>
+ </Tooltip>
{/* The thing you press is the thing that's working is the
thing you press to stop — one element for the whole turn,
@@ -1345,38 +1343,39 @@ export default memo(function ChatComposer({
place (both stacked in the same grid cell) and the progress
ring moves to the perimeter, where it can spin without
fighting the square for the same space. */}
- <button
- type="button"
- onClick={handleSendButtonClick}
- disabled={sendState === "idle"}
- className={`group relative ml-1 inline-grid h-8 w-8 shrink-0 place-items-center rounded-full transition-[background-color,box-shadow,transform] duration-200 active:scale-95 ${SEND_STATE_CLASS[sendState]}`}
- aria-label={sendLabel}
- title={sendTitle}
- >
- {sendState === "streaming" && (
- // Outside the fill, so "still working" reads at a glance
- // and dims on hover to hand the control back as "stop".
- <span className="pointer-events-none absolute -inset-[3px] rounded-full border-2 border-[color-mix(in_srgb,var(--primary)_15%,transparent)] border-t-[var(--primary)] animate-spin transition-opacity group-hover:opacity-30" />
- )}
- <ArrowUp
- size={16}
- strokeWidth={2.5}
- className={`col-start-1 row-start-1 transition-[opacity,transform] duration-200 ${
- sendState === "streaming"
- ? "scale-50 opacity-0"
- : "scale-100 opacity-100"
- }`}
- />
- <Square
- size={10}
- strokeWidth={2.6}
- className={`col-start-1 row-start-1 fill-current transition-[opacity,transform] duration-200 ${
- sendState === "streaming"
- ? "scale-100 opacity-100"
- : "scale-50 opacity-0"
- }`}
- />
- </button>
+ <Tooltip label={sendTitle} side="top">
+ <button
+ type="button"
+ onClick={handleSendButtonClick}
+ disabled={sendState === "idle"}
+ className={`group relative ml-1 inline-grid h-8 w-8 shrink-0 place-items-center rounded-full transition-[background-color,box-shadow,transform] duration-200 active:scale-95 ${SEND_STATE_CLASS[sendState]}`}
+ aria-label={sendLabel}
+ >
+ {sendState === "streaming" && (
+ // Outside the fill, so "still working" reads at a glance
+ // and dims on hover to hand the control back as "stop".
+ <span className="pointer-events-none absolute -inset-[3px] rounded-full border-2 border-[color-mix(in_srgb,var(--primary)_15%,transparent)] border-t-[var(--primary)] animate-spin transition-opacity group-hover:opacity-30" />
+ )}
+ <ArrowUp
+ size={16}
+ strokeWidth={2.5}
+ className={`col-start-1 row-start-1 transition-[opacity,transform] duration-200 ${
+ sendState === "streaming"
+ ? "scale-50 opacity-0"
+ : "scale-100 opacity-100"
+ }`}
+ />
+ <Square
+ size={10}
+ strokeWidth={2.6}
+ className={`col-start-1 row-start-1 fill-current transition-[opacity,transform] duration-200 ${
+ sendState === "streaming"
+ ? "scale-100 opacity-100"
+ : "scale-50 opacity-0"
+ }`}
+ />
+ </button>
+ </Tooltip>
</div>
</div>
</div>
diff --git a/web/components/chat/home/ComposerRail.tsx b/web/components/chat/home/ComposerRail.tsx
index af55d8df2..db6f087d0 100644
--- a/web/components/chat/home/ComposerRail.tsx
+++ b/web/components/chat/home/ComposerRail.tsx
@@ -2,6 +2,7 @@
import { X } from "lucide-react";
import { useTranslation } from "react-i18next";
+import Tooltip from "@/shared/ui/Tooltip";
/** A selected course or resource with a clear action. */
export function RailSlot({
@@ -19,15 +20,16 @@ export function RailSlot({
<div className="group/rail inline-flex min-w-0 max-w-full items-center">
{children}
{onClear ? (
- <button
- type="button"
- onClick={onClear}
- aria-label={label}
- title={label}
- className="-ml-1.5 mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-[var(--muted-foreground)] opacity-60 sm:opacity-0 transition-[opacity,background-color,color] duration-150 hover:bg-[var(--muted)] hover:text-[var(--foreground)] focus-visible:opacity-100 group-hover/rail:opacity-100"
- >
- <X size={12} strokeWidth={2.2} />
- </button>
+ <Tooltip label={label} side="top">
+ <button
+ type="button"
+ onClick={onClear}
+ aria-label={label}
+ className="-ml-1.5 mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-[var(--muted-foreground)] opacity-60 sm:opacity-0 transition-[opacity,background-color,color] duration-150 hover:bg-[var(--muted)] hover:text-[var(--foreground)] focus-visible:opacity-100 group-hover/rail:opacity-100"
+ >
+ <X size={12} strokeWidth={2.2} />
+ </button>
+ </Tooltip>
) : null}
</div>
);
diff --git a/web/components/chat/home/ModelSelector.tsx b/web/components/chat/home/ModelSelector.tsx
index 522d900f8..24fb15b73 100644
--- a/web/components/chat/home/ModelSelector.tsx
+++ b/web/components/chat/home/ModelSelector.tsx
@@ -5,6 +5,7 @@ import { AlertCircle, Bot, Check, ChevronDown } from "lucide-react";
import { useTranslation } from "react-i18next";
import { useLingerExpand } from "@/hooks/use-linger-expand";
import { useOutsideClick } from "@/hooks/use-outside-click";
+import Tooltip from "@/shared/ui/Tooltip";
import ToolbarLabel from "./ToolbarLabel";
import ProviderIcon from "@/components/common/ProviderIcon";
import type { LLMSelection } from "@/features/chat/model/protocol";
@@ -50,7 +51,7 @@ function ModelOptionRow({
return (
<button
type="button"
- title={`${option.model_name} | ${option.profile_name}`}
+ aria-label={`${option.model_name} | ${option.profile_name}`}
onClick={onSelect}
onMouseEnter={() => {
const el = nameRef.current;
@@ -182,42 +183,43 @@ export default function ModelSelector({
return (
<div ref={rootRef} className="relative">
{/* The model name shares the composer selectors' spring and hover delay. */}
- <button
- type="button"
- disabled={disabled}
- onClick={() => {
- if (canRefresh) {
- setOpen(false);
- onRefresh?.();
- return;
- }
- setOpen((current) => !current);
- }}
- aria-label={canRefresh ? t("Refresh models") : t("Select model")}
- title={canRefresh ? t("Refresh models") : label}
- aria-expanded={open}
- {...lingerProps}
- className={`inline-flex h-8 shrink-0 items-center rounded-lg px-2 text-[14px] font-medium transition-[background-color,color,transform] duration-150 active:scale-[0.97] ${
- disabled
- ? "cursor-not-allowed text-[var(--border)]"
- : open
- ? "bg-[var(--muted)] text-[var(--foreground)]"
- : "text-[var(--muted-foreground)] hover:bg-[var(--muted)]/55 hover:text-[var(--foreground)]"
- }`}
- >
- {error ? (
- <AlertCircle size={16} strokeWidth={1.7} className="shrink-0" />
- ) : (
- <ProviderIcon provider={selectedOption?.provider} size={16} />
- )}
- <ToolbarLabel expanded={expanded} fullWidth>
- <span className="min-w-0">{label}</span>
- <ChevronDown
- size={13}
- className={`shrink-0 transition-transform ${open ? "rotate-180" : ""}`}
- />
- </ToolbarLabel>
- </button>
+ <Tooltip label={canRefresh ? t("Refresh models") : label} suppressed={open} side="top">
+ <button
+ type="button"
+ disabled={disabled}
+ onClick={() => {
+ if (canRefresh) {
+ setOpen(false);
+ onRefresh?.();
+ return;
+ }
+ setOpen((current) => !current);
+ }}
+ aria-label={canRefresh ? t("Refresh models") : t("Select model")}
+ aria-expanded={open}
+ {...lingerProps}
+ className={`inline-flex h-8 shrink-0 items-center rounded-lg px-2 text-[14px] font-medium transition-[background-color,color,transform] duration-150 active:scale-[0.97] ${
+ disabled
+ ? "cursor-not-allowed text-[var(--border)]"
+ : open
+ ? "bg-[var(--muted)] text-[var(--foreground)]"
+ : "text-[var(--muted-foreground)] hover:bg-[var(--muted)]/55 hover:text-[var(--foreground)]"
+ }`}
+ >
+ {error ? (
+ <AlertCircle size={16} strokeWidth={1.7} className="shrink-0" />
+ ) : (
+ <ProviderIcon provider={selectedOption?.provider} size={16} />
+ )}
+ <ToolbarLabel expanded={expanded} fullWidth>
+ <span className="min-w-0">{label}</span>
+ <ChevronDown
+ size={13}
+ className={`shrink-0 transition-transform ${open ? "rotate-180" : ""}`}
+ />
+ </ToolbarLabel>
+ </button>
+ </Tooltip>
{open && !disabled && (
<div
@@ -232,7 +234,7 @@ export default function ModelSelector({
{allowSystemDefault && (
<button
type="button"
- title={defaultDetail}
+ aria-label={defaultDetail}
onClick={() => {
onChange(null);
setOpen(false);
diff --git a/web/components/chat/home/ResourceReuse.tsx b/web/components/chat/home/ResourceReuse.tsx
index c8c787b78..8a211766f 100644
--- a/web/components/chat/home/ResourceReuse.tsx
+++ b/web/components/chat/home/ResourceReuse.tsx
@@ -2,6 +2,7 @@
import { createContext, useContext, useMemo, useState } from "react";
import { Pin } from "lucide-react";
import { useTranslation } from "react-i18next";
+import Tooltip from "@/shared/ui/Tooltip";
import {
DEFAULT_RESOURCE_REUSE,
type ResourceKind,
@@ -54,30 +55,31 @@ export function ResourceReuseControl({ kind }: { kind: ResourceKind }) {
if (!context) return null;
const enabled = context.policy[kind];
return (
- <label
- title={t("Include these resources every turn")}
- className={`inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] leading-4 transition-colors focus-within:ring-2 focus-within:ring-[var(--primary)]/30 ${enabled ? "border-[var(--primary)]/20 bg-[var(--primary)]/5 text-[var(--primary)]" : "border-[var(--border)] text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"}`}
- >
- <input
- type="checkbox"
- aria-label={t("Include these resources every turn")}
- checked={enabled}
- onChange={(e) => context.setEveryTurn(kind, e.target.checked)}
- className="peer sr-only"
- />
- <Pin size={12} strokeWidth={1.7} />
- <span>{t(enabled ? "Every turn" : "This turn only")}</span>
- <span
- aria-hidden="true"
- className="relative ml-1 h-3.5 w-6 rounded-full transition-colors"
- style={{
- backgroundColor: enabled ? "var(--primary)" : "var(--border)",
- }}
+ <Tooltip label={t("Include these resources every turn")} side="top">
+ <label
+ className={`inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] leading-4 transition-colors focus-within:ring-2 focus-within:ring-[var(--primary)]/30 ${enabled ? "border-[var(--primary)]/20 bg-[var(--primary)]/5 text-[var(--primary)]" : "border-[var(--border)] text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"}`}
>
- <span
- className={`absolute top-0.5 h-2.5 w-2.5 rounded-full bg-white shadow-sm transition-transform duration-150 motion-reduce:transition-none ${enabled ? "translate-x-3" : "translate-x-0.5"}`}
+ <input
+ type="checkbox"
+ aria-label={t("Include these resources every turn")}
+ checked={enabled}
+ onChange={(e) => context.setEveryTurn(kind, e.target.checked)}
+ className="peer sr-only"
/>
- </span>
- </label>
+ <Pin size={12} strokeWidth={1.7} />
+ <span>{t(enabled ? "Every turn" : "This turn only")}</span>
+ <span
+ aria-hidden="true"
+ className="relative ml-1 h-3.5 w-6 rounded-full transition-colors"
+ style={{
+ backgroundColor: enabled ? "var(--primary)" : "var(--border)",
+ }}
+ >
+ <span
+ className={`absolute top-0.5 h-2.5 w-2.5 rounded-full bg-white shadow-sm transition-transform duration-150 motion-reduce:transition-none ${enabled ? "translate-x-3" : "translate-x-0.5"}`}
+ />
+ </span>
+ </label>
+ </Tooltip>
);
}
diff --git a/web/components/chat/home/SelectedResources.tsx b/web/components/chat/home/SelectedResources.tsx
index c855a4f20..2ab8b2512 100644
--- a/web/components/chat/home/SelectedResources.tsx
+++ b/web/components/chat/home/SelectedResources.tsx
@@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
import { useResourceReuse, ResourceReuseControl } from "./ResourceReuse";
import type { ContextTreeItem } from "./ContextReferenceTree";
import type { ResourceKind } from "@/lib/resource-reuse";
+import Tooltip from "@/shared/ui/Tooltip";
const kinds: Record<string, ResourceKind> = {
file: "attachments",
@@ -56,7 +57,7 @@ export default function SelectedResources({
type="button"
disabled={!item.onClick}
onClick={item.onClick}
- title={`${item.kind} · ${item.label}`}
+ aria-label={`${item.kind} · ${item.label}`}
className="flex min-w-0 items-center gap-1.5 text-left disabled:cursor-default"
>
{item.thumbnailUrl ? (
@@ -73,25 +74,30 @@ export default function SelectedResources({
)}
<span className="truncate">{item.label}</span>
</button>
- <span
- title={t(repeat ? "Every turn" : "This turn only")}
- className="shrink-0 text-[var(--muted-foreground)]"
- >
- {repeat ? (
- <Pin size={11} />
- ) : (
- <span className="text-[10px]">{t("This turn only")}</span>
- )}
- </span>
- {item.onRemove && (
- <button
- type="button"
- aria-label={`${t("Remove")} ${item.label}`}
- onClick={item.onRemove}
- className="rounded p-0.5 text-[var(--muted-foreground)] hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
+ <Tooltip label={t(repeat ? "Every turn" : "This turn only")} side="top">
+ <span
+ role="img"
+ aria-label={t(repeat ? "Every turn" : "This turn only")}
+ className="shrink-0 text-[var(--muted-foreground)]"
>
- <X size={12} />
- </button>
+ {repeat ? (
+ <Pin size={11} aria-hidden="true" />
+ ) : (
+ <span className="text-[10px]">{t("This turn only")}</span>
+ )}
+ </span>
+ </Tooltip>
+ {item.onRemove && (
+ <Tooltip label={`${t("Remove")} ${item.label}`} side="top">
+ <button
+ type="button"
+ aria-label={`${t("Remove")} ${item.label}`}
+ onClick={item.onRemove}
+ className="rounded p-0.5 text-[var(--muted-foreground)] hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
+ >
+ <X size={12} />
+ </button>
+ </Tooltip>
)}
</motion.div>
);
diff --git a/web/components/chat/home/SessionActivityPanel.tsx b/web/components/chat/home/SessionActivityPanel.tsx
index 2ca2023cf..eb8b00871 100644
--- a/web/components/chat/home/SessionActivityPanel.tsx
+++ b/web/components/chat/home/SessionActivityPanel.tsx
@@ -33,6 +33,7 @@ import { listSessions, type SessionSummary } from "@/lib/session-api";
import { listNotebooks, type NotebookSummary } from "@/lib/notebook-api";
import { bookApi } from "@/lib/book-api";
import type { Book } from "@/lib/book-types";
+import Tooltip from "@/shared/ui/Tooltip";
import {
artifactDiskPath,
@@ -535,13 +536,13 @@ function AttachmentRow({
: null;
return (
- <li>
- <button
- type="button"
- onClick={onOpen}
- title={diskPath ?? undefined}
- className={`group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors ${ACTIVITY_ROW_HOVER} focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ring)]`}
- >
+ <li className="[&>span]:w-full">
+ <Tooltip label={filename} description={diskPath ?? undefined} side="left">
+ <button
+ type="button"
+ onClick={onOpen}
+ className={`group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors ${ACTIVITY_ROW_HOVER} focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ring)]`}
+ >
<span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--card)]">
<Icon
size={13}
@@ -563,7 +564,8 @@ function AttachmentRow({
aria-hidden="true"
className="shrink-0 text-[var(--muted-foreground)]/65 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
/>
- </button>
+ </button>
+ </Tooltip>
</li>
);
}
diff --git a/web/components/chat/home/SessionViewerPanel.tsx b/web/components/chat/home/SessionViewerPanel.tsx
index ebca2ad01..016597101 100644
--- a/web/components/chat/home/SessionViewerPanel.tsx
+++ b/web/components/chat/home/SessionViewerPanel.tsx
@@ -65,6 +65,7 @@ import type { GeogebraTabPayload } from "@/context/GeogebraTabContext";
import { apiUrl } from "@/lib/api";
import type { MessageAttachment } from "@/features/chat/ChatStateAdapter";
import type { StreamEvent } from "@/features/chat/model/protocol";
+import Tooltip from "@/shared/ui/Tooltip";
import {
normalizeSelectedText,
selectionTutorKey,
@@ -842,7 +843,6 @@ function TabBar({
onClick={onSelectHome}
aria-pressed={homeActive}
className={`${TAB_PILL} ${TAB_FOCUS} gap-1.5 px-2.5 ${homeActive ? TAB_ACTIVE : TAB_IDLE}`}
- title={t("Activity")}
>
<Activity size={13} strokeWidth={1.8} className="shrink-0" />
<span>{t("Activity")}</span>
@@ -867,30 +867,32 @@ function TabBar({
<div
key={tab.id}
className={`group ${TAB_PILL} max-w-[190px] ${active ? TAB_ACTIVE : TAB_IDLE}`}
- title={tab.label}
>
<button
type="button"
onClick={() => onSelect(tab.id)}
aria-pressed={active}
+ aria-label={tab.label}
className={`inline-flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-lg pl-2.5 pr-1 text-left ${TAB_FOCUS}`}
>
<Icon size={13} strokeWidth={1.8} className="shrink-0" />
<span className="truncate">{tab.label}</span>
</button>
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- onCloseTab(tab.id);
- }}
- className={`mr-1 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-[var(--muted-foreground)] transition-[opacity,background-color,color] hover:bg-[color-mix(in_srgb,var(--foreground)_8%,transparent)] hover:text-[var(--foreground)] focus-visible:opacity-100 ${TAB_FOCUS} ${
- active ? "opacity-70" : "opacity-0 group-hover:opacity-70"
- }`}
- aria-label={t("Close tab")}
- >
- <X size={12} strokeWidth={2} />
- </button>
+ <Tooltip label={t("Close tab")} side="bottom">
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ onCloseTab(tab.id);
+ }}
+ className={`mr-1 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-[var(--muted-foreground)] transition-[opacity,background-color,color] hover:bg-[color-mix(in_srgb,var(--foreground)_8%,transparent)] hover:text-[var(--foreground)] focus-visible:opacity-100 ${TAB_FOCUS} ${
+ active ? "opacity-70" : "opacity-0 group-hover:opacity-70"
+ }`}
+ aria-label={t("Close tab")}
+ >
+ <X size={12} strokeWidth={2} />
+ </button>
+ </Tooltip>
</div>
);
})}
@@ -904,24 +906,26 @@ function TabBar({
/>
</>
) : null}
- <button
- type="button"
- onClick={onNewTab}
- className={HEADER_ICON}
- aria-label={t("New tab")}
- title={t("New tab")}
- >
- <Plus size={16} strokeWidth={1.8} />
- </button>
- <button
- type="button"
- onClick={onClosePanel}
- className={HEADER_ICON}
- aria-label={t("Close viewer")}
- title={t("Close viewer")}
- >
- <X size={15} strokeWidth={1.8} />
- </button>
+ <Tooltip label={t("New tab")} side="bottom">
+ <button
+ type="button"
+ onClick={onNewTab}
+ className={HEADER_ICON}
+ aria-label={t("New tab")}
+ >
+ <Plus size={16} strokeWidth={1.8} />
+ </button>
+ </Tooltip>
+ <Tooltip label={t("Close viewer")} side="bottom">
+ <button
+ type="button"
+ onClick={onClosePanel}
+ className={HEADER_ICON}
+ aria-label={t("Close viewer")}
+ >
+ <X size={15} strokeWidth={1.8} />
+ </button>
+ </Tooltip>
</div>
);
}
@@ -1100,28 +1104,30 @@ function FileTabActions({ source }: { source: FilePreviewSource }) {
return (
<>
{fileUrl ? (
- <a
- href={fileUrl}
- download={filename}
+ <Tooltip label={t("Download")} side="bottom">
+ <a
+ href={fileUrl}
+ download={filename}
+ className={HEADER_ICON}
+ aria-label={t("Download")}
+ >
+ <Download size={15} strokeWidth={1.8} />
+ </a>
+ </Tooltip>
+ ) : null}
+ <Tooltip label={t("Open in browser")} side="bottom">
+ <button
+ type="button"
+ onClick={() => {
+ if (fileUrl) window.open(fileUrl, "_blank", "noopener,noreferrer");
+ }}
+ disabled={!fileUrl}
className={HEADER_ICON}
- aria-label={t("Download")}
- title={t("Download")}
+ aria-label={t("Open in browser")}
>
- <Download size={15} strokeWidth={1.8} />
- </a>
- ) : null}
- <button
- type="button"
- onClick={() => {
- if (fileUrl) window.open(fileUrl, "_blank", "noopener,noreferrer");
- }}
- disabled={!fileUrl}
- className={HEADER_ICON}
- aria-label={t("Open in browser")}
- title={t("Open in browser")}
- >
- <ExternalLink size={14} strokeWidth={1.8} />
- </button>
+ <ExternalLink size={14} strokeWidth={1.8} />
+ </button>
+ </Tooltip>
</>
);
}
diff --git a/web/components/chat/home/StarterSuggestions.tsx b/web/components/chat/home/StarterSuggestions.tsx
index 54c9f347d..4b75bdede 100644
--- a/web/components/chat/home/StarterSuggestions.tsx
+++ b/web/components/chat/home/StarterSuggestions.tsx
@@ -2,6 +2,7 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
+import Tooltip from "@/shared/ui/Tooltip";
import { Loader2, Sparkles } from "lucide-react";
import { activeWorkspaceId, scopedUrl } from "@/lib/workspace-scope";
import { apiFetch, apiUrl } from "@/lib/api";
@@ -188,23 +189,25 @@ export default function StarterSuggestions({
<ul className="flex flex-col items-start">
{view.items.map((item) => (
<li key={item.label} className="max-w-full">
- <button
- type="button"
- disabled={disabled}
- onClick={() => onPick(item.prompt)}
- title={item.prompt}
- className="group/line flex max-w-full items-baseline gap-2 py-[5px] text-left font-serif text-[15.5px] leading-[1.45] tracking-[-0.005em] text-[color-mix(in_srgb,var(--foreground)_72%,transparent)] transition-colors duration-200 hover:text-[var(--primary)] focus-visible:text-[var(--primary)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40"
- >
- <span className="truncate">{item.label}</span>
- {/* The arrow is the invitation: coloured at rest so the line
- reads as something to click, and it steps right on hover. */}
- <span
- aria-hidden="true"
- className="shrink-0 text-[color-mix(in_srgb,var(--primary)_65%,transparent)] transition-all duration-200 ease-out group-hover/line:translate-x-1 group-hover/line:text-[var(--primary)] group-focus-visible/line:translate-x-1"
+ <Tooltip label={item.prompt} side="top">
+ <button
+ type="button"
+ disabled={disabled}
+ onClick={() => onPick(item.prompt)}
+ aria-label={item.prompt}
+ className="group/line flex max-w-full items-baseline gap-2 py-[5px] text-left font-serif text-[15.5px] leading-[1.45] tracking-[-0.005em] text-[color-mix(in_srgb,var(--foreground)_72%,transparent)] transition-colors duration-200 hover:text-[var(--primary)] focus-visible:text-[var(--primary)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40"
>
- →
- </span>
- </button>
+ <span className="truncate">{item.label}</span>
+ {/* The arrow is the invitation: coloured at rest so the line
+ reads as something to click, and it steps right on hover. */}
+ <span
+ aria-hidden="true"
+ className="shrink-0 text-[color-mix(in_srgb,var(--primary)_65%,transparent)] transition-all duration-200 ease-out group-hover/line:translate-x-1 group-hover/line:text-[var(--primary)] group-focus-visible/line:translate-x-1"
+ >
+ →
+ </span>
+ </button>
+ </Tooltip>
</li>
))}
</ul>
diff --git a/web/components/chat/preview/FilePreviewDrawer.tsx b/web/components/chat/preview/FilePreviewDrawer.tsx
index 03c0e8866..30bca2ea6 100644
--- a/web/components/chat/preview/FilePreviewDrawer.tsx
+++ b/web/components/chat/preview/FilePreviewDrawer.tsx
@@ -12,6 +12,7 @@ import { apiUrl } from "@/lib/api";
import { apiFetch } from "@/lib/api";
import { uploadMaterial } from "@/lib/reading-api";
import { createReadingWorkspace } from "@/lib/reading-workspace-api";
+import Tooltip from "@/shared/ui/Tooltip";
import {
type FilePreviewSource,
previewKindFor,
@@ -246,62 +247,67 @@ export default function FilePreviewDrawer({
</div>
{canOpenInReading && downloadUrl && (
- <button
- type="button"
- onClick={() => void handleOpenInReading()}
- disabled={openingInReader}
- title={t("Open in Immersive Reading")}
- className="mr-1 inline-flex h-8 items-center gap-1.5 rounded-lg bg-[var(--primary)]/10 px-2.5 text-[10px] font-semibold text-[var(--primary)] transition hover:bg-[var(--primary)]/15 disabled:opacity-50"
- >
- {openingInReader ? (
- <Loader2 size={12} className="animate-spin" />
- ) : (
- <BookOpenText size={12} />
- )}
- <span className="hidden sm:inline">{t("Open in Reading")}</span>
- </button>
+ <Tooltip label={t("Open in Immersive Reading")} side="bottom">
+ <button
+ type="button"
+ onClick={() => void handleOpenInReading()}
+ disabled={openingInReader}
+ aria-label={t("Open in Immersive Reading")}
+ className="mr-1 inline-flex h-8 items-center gap-1.5 rounded-lg bg-[var(--primary)]/10 px-2.5 text-[10px] font-semibold text-[var(--primary)] transition hover:bg-[var(--primary)]/15 disabled:opacity-50"
+ >
+ {openingInReader ? (
+ <Loader2 size={12} className="animate-spin" />
+ ) : (
+ <BookOpenText size={12} />
+ )}
+ <span className="hidden sm:inline">{t("Open in Reading")}</span>
+ </button>
+ </Tooltip>
)}
{downloadUrl && (
- <a
- href={downloadUrl}
- download={filename}
- title={t("Download")}
- aria-label={t("Download")}
- className="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
- >
- <Download size={14} strokeWidth={1.7} />
- </a>
+ <Tooltip label={t("Download")} side="bottom">
+ <a
+ href={downloadUrl}
+ download={filename}
+ aria-label={t("Download")}
+ className="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
+ >
+ <Download size={14} strokeWidth={1.7} />
+ </a>
+ </Tooltip>
)}
{downloadUrl && (
+ <Tooltip label={t("Copy link")} side="bottom">
+ <button
+ type="button"
+ onClick={handleCopy}
+ aria-label={t("Copy link")}
+ className="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
+ >
+ {copied ? (
+ <Check
+ size={14}
+ strokeWidth={1.7}
+ className="text-emerald-500"
+ />
+ ) : (
+ <Copy size={14} strokeWidth={1.7} />
+ )}
+ </button>
+ </Tooltip>
+ )}
+ <Tooltip label={t("Close")} side="bottom">
<button
+ ref={closeBtnRef}
type="button"
- onClick={handleCopy}
- title={t("Copy link")}
- aria-label={t("Copy link")}
+ onClick={onClose}
+ aria-label={t("Close")}
className="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
>
- {copied ? (
- <Check
- size={14}
- strokeWidth={1.7}
- className="text-emerald-500"
- />
- ) : (
- <Copy size={14} strokeWidth={1.7} />
- )}
+ <X size={15} strokeWidth={1.8} />
</button>
- )}
- <button
- ref={closeBtnRef}
- type="button"
- onClick={onClose}
- title={t("Close")}
- aria-label={t("Close")}
- className="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
- >
- <X size={15} strokeWidth={1.8} />
- </button>
+ </Tooltip>
</div>
{readerError && (
diff --git a/web/components/chat/preview/previewers/XlsxPreview.tsx b/web/components/chat/preview/previewers/XlsxPreview.tsx
index bd35daf6e..2d3f52fbc 100644
--- a/web/components/chat/preview/previewers/XlsxPreview.tsx
+++ b/web/components/chat/preview/previewers/XlsxPreview.tsx
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
import { AlertCircle, Loader2 } from "lucide-react";
import { useTranslation } from "react-i18next";
import { useBinarySource } from "./useBinarySource";
+import Tooltip from "@/shared/ui/Tooltip";
// Preview bounds — a spreadsheet can hold millions of cells; rendering them
// all would lock the tab. We cap and flag truncation; Download gets the rest.
@@ -147,19 +148,20 @@ export default function XlsxPreview({ url }: { url: string }) {
{sheets.length > 1 ? (
<div className="flex shrink-0 items-center gap-1 overflow-x-auto border-t border-[var(--border)]/40 bg-[var(--muted)]/25 px-2 py-1.5">
{sheets.map((s, i) => (
- <button
- key={`${s.name}-${i}`}
- type="button"
- onClick={() => setActive(i)}
- className={`shrink-0 rounded-md px-2.5 py-1 text-[11.5px] font-medium transition-colors ${
- i === active
- ? "bg-[var(--card)] text-[var(--foreground)] shadow-sm"
- : "text-[var(--muted-foreground)] hover:bg-[var(--card)]/70 hover:text-[var(--foreground)]"
- }`}
- title={s.name}
- >
- <span className="block max-w-[140px] truncate">{s.name}</span>
- </button>
+ <Tooltip key={`${s.name}-${i}`} label={s.name} side="top">
+ <button
+ type="button"
+ onClick={() => setActive(i)}
+ aria-label={s.name}
+ className={`shrink-0 rounded-md px-2.5 py-1 text-[11.5px] font-medium transition-colors ${
+ i === active
+ ? "bg-[var(--card)] text-[var(--foreground)] shadow-sm"
+ : "text-[var(--muted-foreground)] hover:bg-[var(--card)]/70 hover:text-[var(--foreground)]"
+ }`}
+ >
+ <span className="block max-w-[140px] truncate">{s.name}</span>
+ </button>
+ </Tooltip>
))}
</div>
) : null}
diff --git a/web/features/chat/components/ChatWorkspace.tsx b/web/features/chat/components/ChatWorkspace.tsx
index b0bfa0ece..ff98cce8c 100644
--- a/web/features/chat/components/ChatWorkspace.tsx
+++ b/web/features/chat/components/ChatWorkspace.tsx
@@ -2448,21 +2448,22 @@ export default function ChatWorkspace({
conversation says which workspace's files it can see without
the learner opening a menu to find out. */}
{activeWorkspace ? (
- <Link
- href="/settings/workspace"
- title={activeWorkspace.path}
- className="inline-flex shrink-0 items-center gap-1 rounded-lg px-1.5 py-1 text-[12.5px] text-[var(--muted-foreground)] transition hover:bg-[var(--muted)]/55 hover:text-[var(--foreground)]"
- >
- <FolderOpen size={13} strokeWidth={1.7} />
- <span className="max-w-[140px] truncate">
- {activeWorkspace.display_name}
- </span>
- <ChevronRight
- size={12}
- strokeWidth={2}
- className="-mr-1 opacity-60"
- />
- </Link>
+ <Tooltip label={activeWorkspace.path} side="bottom">
+ <Link
+ href="/settings/workspace"
+ className="inline-flex shrink-0 items-center gap-1 rounded-lg px-1.5 py-1 text-[12.5px] text-[var(--muted-foreground)] transition hover:bg-[var(--muted)]/55 hover:text-[var(--foreground)]"
+ >
+ <FolderOpen size={13} strokeWidth={1.7} />
+ <span className="max-w-[140px] truncate">
+ {activeWorkspace.display_name}
+ </span>
+ <ChevronRight
+ size={12}
+ strokeWidth={2}
+ className="-mr-1 opacity-60"
+ />
+ </Link>
+ </Tooltip>
) : null}
{sessionTitleEditing ? (
<input
@@ -2479,22 +2480,24 @@ export default function ChatWorkspace({
maxLength={100}
/>
) : (
- <button
- type="button"
- onClick={startSessionTitleEdit}
- disabled={!canRenameSession}
- title={
- canRenameSession
- ? t("Click to rename session")
- : t("Start a conversation to rename")
- }
- className="inline-flex min-w-0 max-w-full items-center gap-2 rounded-xl px-2 py-1 text-left font-serif text-[17px] font-semibold tracking-[-0.01em] text-[var(--foreground)] transition hover:bg-[var(--muted)]/55 disabled:cursor-default disabled:hover:bg-transparent"
+ <Tooltip
+ label={canRenameSession
+ ? t("Click to rename session")
+ : t("Start a conversation to rename")}
+ side="bottom"
>
- <span className="truncate">{displaySessionTitle}</span>
- {canRenameSession ? (
- <PenLine className="h-3.5 w-3.5 shrink-0 text-[var(--muted-foreground)] opacity-0 transition-opacity group-hover/title:opacity-100" />
- ) : null}
- </button>
+ <button
+ type="button"
+ onClick={startSessionTitleEdit}
+ disabled={!canRenameSession}
+ className="inline-flex min-w-0 max-w-full items-center gap-2 rounded-xl px-2 py-1 text-left font-serif text-[17px] font-semibold tracking-[-0.01em] text-[var(--foreground)] transition hover:bg-[var(--muted)]/55 disabled:cursor-default disabled:hover:bg-transparent"
+ >
+ <span className="truncate">{displaySessionTitle}</span>
+ {canRenameSession ? (
+ <PenLine className="h-3.5 w-3.5 shrink-0 text-[var(--muted-foreground)] opacity-0 transition-opacity group-hover/title:opacity-100" />
+ ) : null}
+ </button>
+ </Tooltip>
)}
{sessionTitleSaving ? (
<span className="shrink-0 text-xs text-[var(--muted-foreground)]">
diff --git a/web/features/chat/messages/ChatMessageList.tsx b/web/features/chat/messages/ChatMessageList.tsx
index 0be23080a..5647949c3 100644
--- a/web/features/chat/messages/ChatMessageList.tsx
+++ b/web/features/chat/messages/ChatMessageList.tsx
@@ -1854,7 +1854,7 @@ function ReadingPassageQuote({ quote, href }: { quote: string; href?: string })
return href ? (
<a
href={href}
- title={t("Go to this passage")}
+ aria-label={`${t("Go to this passage")}: ${quote}`}
className={`${className} transition-colors hover:text-[var(--foreground)]`}
>
{text}