DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
Replace forwarded link titles with accessible tooltips
Bingxi Zhao (Frank)d2810c28127f
diff --git a/web/components/UserAvatar.tsx b/web/components/UserAvatar.tsxindex cdf85c246..1bb7c337f 100644--- a/web/components/UserAvatar.tsx+++ b/web/components/UserAvatar.tsx@@ -137,7 +137,6 @@ export function UserAvatar({<spanclassName={`relative inline-flex shrink-0 ${className ?? ""}`}style={{ width: size, height: size }}- title={isAdmin ? `${username} — ${adminLabel}` : username}aria-label={isAdmin ? `${username} (${adminLabel})` : username}>{isImage ? (diff --git a/web/components/auth/AdminLink.tsx b/web/components/auth/AdminLink.tsxindex 416570ec1..58bbcf454 100644--- a/web/components/auth/AdminLink.tsx+++ b/web/components/auth/AdminLink.tsx@@ -5,6 +5,7 @@ import { usePathname } from "next/navigation";import { ShieldCheck } from "lucide-react";import { useTranslation } from "react-i18next";import { useAuthStatus } from "@/hooks/useAuthStatus";+import Tooltip from "@/shared/ui/Tooltip";interface AdminLinkProps {collapsed?: boolean;@@ -21,19 +22,20 @@ export function AdminLink({ collapsed = false }: AdminLinkProps) {if (collapsed) {return (- <Link- href="/admin/users"- className={`rounded-lg p-2 transition-colors- ${- active- ? "bg-[var(--primary)]/10 text-[var(--primary)]"- : "text-[var(--muted-foreground)] hover:bg-[var(--background)]/50 hover:text-[var(--foreground)]"- }`}- aria-label={t("Admin")}- title={t("Admin — User Management")}- >- <ShieldCheck size={16} strokeWidth={1.5} />- </Link>+ <Tooltip label={t("Admin — User Management")} side="right">+ <Link+ href="/admin/users"+ className={`rounded-lg p-2 transition-colors+ ${+ active+ ? "bg-[var(--primary)]/10 text-[var(--primary)]"+ : "text-[var(--muted-foreground)] hover:bg-[var(--background)]/50 hover:text-[var(--foreground)]"+ }`}+ aria-label={t("Admin")}+ >+ <ShieldCheck size={16} strokeWidth={1.5} />+ </Link>+ </Tooltip>);}diff --git a/web/components/auth/ProfileLink.tsx b/web/components/auth/ProfileLink.tsxindex d579cdd98..b74dbef23 100644--- a/web/components/auth/ProfileLink.tsx+++ b/web/components/auth/ProfileLink.tsx@@ -6,6 +6,7 @@ import { usePathname } from "next/navigation";import { useTranslation } from "react-i18next";import { fetchAuthStatus, type AuthStatus } from "@/lib/auth";import { UserAvatar } from "@/components/UserAvatar";+import Tooltip from "@/shared/ui/Tooltip";interface ProfileLinkProps {collapsed?: boolean;@@ -38,35 +39,37 @@ export function ProfileLink({ collapsed = false }: ProfileLinkProps) {if (collapsed) {return (+ <Tooltip label={`${t("My profile")} — ${status.username}`} side="right">+ <Link+ href="/profile"+ className={`rounded-lg p-2 transition-colors+ ${+ active+ ? "bg-[var(--primary)]/10 text-[var(--primary)]"+ : "text-[var(--muted-foreground)] hover:bg-[var(--background)]/50 hover:text-[var(--foreground)]"+ }`}+ aria-label={t("My profile")}+ >+ {avatar}+ </Link>+ </Tooltip>+ );+ }++ return (+ <Tooltip label={t("My profile")} as="div" className="w-full" side="right"><Linkhref="/profile"- className={`rounded-lg p-2 transition-colors+ className={`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13.5px] transition-colors${active? "bg-[var(--primary)]/10 text-[var(--primary)]": "text-[var(--muted-foreground)] hover:bg-[var(--background)]/50 hover:text-[var(--foreground)]"}`}- aria-label={t("My profile")}- title={`${t("My profile")} — ${status.username}`}>{avatar}+ <span className="truncate">{status.username}</span></Link>- );- }-- return (- <Link- href="/profile"- className={`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13.5px] transition-colors- ${- active- ? "bg-[var(--primary)]/10 text-[var(--primary)]"- : "text-[var(--muted-foreground)] hover:bg-[var(--background)]/50 hover:text-[var(--foreground)]"- }`}- title={t("My profile")}- >- {avatar}- <span className="truncate">{status.username}</span>- </Link>+ </Tooltip>);}diff --git a/web/components/common/BrandIcon.tsx b/web/components/common/BrandIcon.tsxindex 7a5cc515d..472c1bb59 100644--- a/web/components/common/BrandIcon.tsx+++ b/web/components/common/BrandIcon.tsx@@ -45,7 +45,6 @@ export default function BrandIcon({// The name is already adjacent in every current caller, so the mark is// decorative and announcing it again would just double every row.aria-hidden- title={icon ? icon.title : name}className={`flex shrink-0 items-center justify-center rounded-lg border border-[var(--border)]/60 bg-[var(--background)] font-semibold tracking-tight text-[var(--muted-foreground)] ${box} ${className}`}>{icon ? (diff --git a/web/components/reading/workspace/MediaReadingStage.tsx b/web/components/reading/workspace/MediaReadingStage.tsxindex 8facd4b80..8d3b8cf0b 100644--- a/web/components/reading/workspace/MediaReadingStage.tsx+++ b/web/components/reading/workspace/MediaReadingStage.tsx@@ -546,7 +546,6 @@ export function MediaReadingStage({<YouTubeReadingPlayervideoId={youtubeId}startSeconds={startSeconds}- title={title}onController={handleController}onTime={handleTime}onPersist={persist}diff --git a/web/components/reading/workspace/YouTubeReadingPlayer.tsx b/web/components/reading/workspace/YouTubeReadingPlayer.tsxindex 2eaf0f871..cc949e15a 100644--- a/web/components/reading/workspace/YouTubeReadingPlayer.tsx+++ b/web/components/reading/workspace/YouTubeReadingPlayer.tsx@@ -11,7 +11,6 @@ import { loadYouTubeApi } from "@/lib/youtube-iframe-api";export function YouTubeReadingPlayer({videoId,startSeconds,- title,onController,onTime,onPersist,@@ -19,7 +18,6 @@ export function YouTubeReadingPlayer({}: {videoId: string;startSeconds: number;- title: string;onController(controller: ReadingMediaController | null): void;onTime(seconds: number, duration: number): void;onPersist(): void;@@ -94,11 +92,5 @@ export function YouTubeReadingPlayer({};}, [onController, onError, onPersist, onTime, startSeconds, videoId]);- return (- <div- ref={playerRootRef}- className="aspect-video w-full bg-black"- title={title}- />- );+ return <div ref={playerRootRef} className="aspect-video w-full bg-black" />;}diff --git a/web/components/settings/SettingsNav.tsx b/web/components/settings/SettingsNav.tsxindex f114fb8b5..9c3e30697 100644--- a/web/components/settings/SettingsNav.tsx+++ b/web/components/settings/SettingsNav.tsx@@ -5,6 +5,7 @@ import Link from 'next/link'import { usePathname } from 'next/navigation'import { Search, X } from 'lucide-react'import { useTranslation } from 'react-i18next'+import Tooltip from '@/shared/ui/Tooltip'import { useSettingsAccess } from '@/features/settings/navigation/SettingsAccessProvider'import { settingsAnchorHref, type Lang } from '@/features/settings/navigation/settings-nav'import {@@ -92,21 +93,21 @@ export default function SettingsNav({ onNavigate }: { onNavigate?: () => void })const Icon = needle ? page.icon : settingsPageIcon(page.key, page.icon)const active = needle ? page.key === currentKey : currentFamily.includes(page.key)return (- <Link- key={page.key}- href={settingsAnchorHref(page.key)}- scroll={false}- onClick={onNavigate}- aria-current={active ? 'page' : undefined}- title={tr(page.blurb)}- data-tour={`tour-nav-${page.key}`}- className={`flex min-h-8 items-center gap-2 rounded-md px-2.5 py-1.5 text-[13px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--ring)] ${active ? 'bg-[var(--accent)] font-medium text-[var(--foreground)]' : 'text-[var(--foreground)] hover:bg-accent/60'}`}- >- <Icon size={15} strokeWidth={1.8} className="shrink-0" />- <span>- {tr(needle ? page.label : settingsPageLabel(page.key, page.label))}- </span>- </Link>+ <Tooltip key={page.key} label={tr(page.blurb)} as="div" side="right">+ <Link+ href={settingsAnchorHref(page.key)}+ scroll={false}+ onClick={onNavigate}+ aria-current={active ? 'page' : undefined}+ data-tour={`tour-nav-${page.key}`}+ className={`flex min-h-8 items-center gap-2 rounded-md px-2.5 py-1.5 text-[13px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--ring)] ${active ? 'bg-[var(--accent)] font-medium text-[var(--foreground)]' : 'text-[var(--foreground)] hover:bg-accent/60'}`}+ >+ <Icon size={15} strokeWidth={1.8} className="shrink-0" />+ <span>+ {tr(needle ? page.label : settingsPageLabel(page.key, page.label))}+ </span>+ </Link>+ </Tooltip>)})}</div>diff --git a/web/components/sidebar/SidebarShell.tsx b/web/components/sidebar/SidebarShell.tsxindex c609aad92..e343cd52f 100644--- a/web/components/sidebar/SidebarShell.tsx+++ b/web/components/sidebar/SidebarShell.tsx@@ -31,6 +31,7 @@ import type { StudyCourse } from "@/lib/courses-api";import { useSidebarResize } from "@/hooks/useSidebarResize";import { SidebarHome, SidebarNav } from "@/components/sidebar/SidebarNav";import { SECONDARY_NAV, isNavActive } from "@/components/sidebar/nav-entries";+import Tooltip from "@/shared/ui/Tooltip";import {mergeManualOrder,readSessionOrder,@@ -224,19 +225,20 @@ export function SidebarShell({{SECONDARY_NAV.map((item) => {const active = isNavActive(pathname, item.href);return (- <Link- key={item.href}- href={item.href}- prefetch={false}- title={t(item.label) as string}- className={`relative flex h-9 w-9 items-center justify-center rounded-xl transition-all duration-150 ${- active- ? "bg-[var(--accent)] text-[var(--foreground)] shadow-sm"- : "text-foreground/85 hover:bg-background/60 hover:text-[var(--foreground)]"- }`}- >- <item.icon size={18} strokeWidth={active ? 2 : 1.6} />- </Link>+ <Tooltip key={item.href} label={t(item.label) as string} side="right">+ <Link+ href={item.href}+ prefetch={false}+ aria-label={t(item.label) as string}+ className={`relative flex h-9 w-9 items-center justify-center rounded-xl transition-all duration-150 ${+ active+ ? "bg-[var(--accent)] text-[var(--foreground)] shadow-sm"+ : "text-foreground/85 hover:bg-background/60 hover:text-[var(--foreground)]"+ }`}+ >+ <item.icon size={18} strokeWidth={active ? 2 : 1.6} />+ </Link>+ </Tooltip>);})}{renderedFooter}diff --git a/web/components/sidebar/VersionBadge.tsx b/web/components/sidebar/VersionBadge.tsxindex 931477549..0cd3cf737 100644--- a/web/components/sidebar/VersionBadge.tsx+++ b/web/components/sidebar/VersionBadge.tsx@@ -3,6 +3,7 @@import Link from "next/link";import { useEffect, useState, type MouseEventHandler } from "react";import { useTranslation } from "react-i18next";+import Tooltip from "@/shared/ui/Tooltip";import {fetchAppUpdateStatus,@@ -62,18 +63,19 @@ export function VersionBadge({ onNavigate }: VersionBadgeProps) {};return (- <Link- href="/settings/about"- prefetch={false}- onClick={onNavigate}- title={state.label as string}- aria-label={state.label as string}- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-background/50 hover:text-[var(--foreground)]"- >- <span- aria-hidden="true"- className={`h-1.5 w-1.5 rounded-full transition-colors ${state.dot}`}- />- </Link>+ <Tooltip label={state.label as string} side="right">+ <Link+ href="/settings/about"+ prefetch={false}+ onClick={onNavigate}+ aria-label={state.label as string}+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-background/50 hover:text-[var(--foreground)]"+ >+ <span+ aria-hidden="true"+ className={`h-1.5 w-1.5 rounded-full transition-colors ${state.dot}`}+ />+ </Link>+ </Tooltip>);}diff --git a/web/components/space/learning/MasteryStudy.tsx b/web/components/space/learning/MasteryStudy.tsxindex 421bc3cb0..dbb035339 100644--- a/web/components/space/learning/MasteryStudy.tsx+++ b/web/components/space/learning/MasteryStudy.tsx@@ -560,14 +560,15 @@ export function MasteryStudy({unit rather than a ring on the left and its own number on theright saying the same thing twice. */}<header className="flex h-[56px] shrink-0 items-center gap-1 border-b border-[var(--border)] bg-[var(--background)]/95 px-3 backdrop-blur sm:px-4">- <Link- href={masteryTopicRoute(pathId)}- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]/60 hover:text-[var(--foreground)]"- title={t("Learning topics")}- aria-label={t("Learning topics")}- >- <ArrowLeft className="h-4 w-4" />- </Link>+ <Tooltip label={t("Learning topics")} side="bottom">+ <Link+ href={masteryTopicRoute(pathId)}+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]/60 hover:text-[var(--foreground)]"+ aria-label={t("Learning topics")}+ >+ <ArrowLeft className="h-4 w-4" />+ </Link>+ </Tooltip><div className="ml-1.5 flex min-w-0 flex-1 items-baseline gap-2"><h1 className="shrink-0 truncate text-[14.5px] font-semibold tracking-[-0.01em] text-[var(--foreground)]">diff --git a/web/tests/native-button-title.test.ts b/web/tests/native-button-title.test.tsindex ba9851c9a..2a7f31bc7 100644--- a/web/tests/native-button-title.test.ts+++ b/web/tests/native-button-title.test.ts@@ -24,7 +24,7 @@ function attribute()}-test('native button hints must use the shared Tooltip', () => {+test('interactive native title hints must use the shared Tooltip', () => {const violations: string[] = []for (const sourceRoot of ['app', 'components', 'context', 'features', 'hooks', 'lib', 'shared']) {for (const file of sourceFiles(path.join(root, sourceRoot))) {@@ -36,14 +36,34 @@ test('native button hints must use the shared Tooltip', () => {true,ts.ScriptKind.TSX)+ const nextLinkNames = new Set(+ source.statements+ .filter((statement): statement is ts.ImportDeclaration => ts.isImportDeclaration(statement))+ .filter(+ statement =>+ ts.isStringLiteral(statement.moduleSpecifier) &&+ statement.moduleSpecifier.text === 'next/link'+ )+ .map(statement => statement.importClause?.name?.text)+ .filter((name): name is string => Boolean(name))+ )const visit = (node: ts.Node) => {- if (- (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) &&- node.tagName.getText(source) === 'button' &&- attribute(node, 'title')- ) {- const line = source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1- violations.push(`${relative}:${line}`)+ if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) {+ const tag = node.tagName.getText(source)+ const role = attribute(node, 'role')?.initializer?.getText(source) ?? ''+ const interactive =+ tag === 'button' ||+ tag === 'a' ||+ nextLinkNames.has(tag) ||+ (/^[a-z]/.test(tag) &&+ (['onClick', 'onMouseDown', 'onPointerDown', 'tabIndex'].some(name =>+ attribute(node, name)+ ) ||+ /\b(button|separator)\b/.test(role)))+ if (interactive && attribute(node, 'title')) {+ const line = source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1+ violations.push(`${relative}:${line}`)+ }}ts.forEachChild(node, visit)}@@ -53,6 +73,6 @@ test('native button hints must use the shared Tooltip', () => {assert.deepEqual(violations,[],- 'Replace <button title> hints with @/shared/ui/Tooltip and an accessible button name'+ 'Replace interactive native title hints with @/shared/ui/Tooltip and an accessible name')})