Skip to content

refactor(studio): move the learning refresh tooltip to the Tooltip primitive - #2357

Merged
peppescg merged 2 commits into
mainfrom
refactor/studio-tooltips-2341
Oct 15, 2026
Merged

peppescg merged 2 commits into
mainfrom
refactor/studio-tooltips-2341

Conversation

@peppescg

@peppescg peppescg commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Audits every title= in apps/web/src/features/knowledge/, learning/, search/ and memory/ against the Tooltip primitive (components/ui/tooltip.tsx). One is a native tooltip on an interactive control: the icon-only Refresh suggestions button in Settings > Learning. It now uses Tooltip, which also opens on keyboard focus, and keeps its aria-label. The other 21 occurrences stay, for the reasons in the table. Nine of them are in files that open PRs change (#2334, #2352), and five of those are disabled-reason titles on buttons that are candidates for later.

Part of #2341
Part of #2201
Part of #2210

What changed

  • learning/learning-settings-page.tsx: the Refresh suggestions Button is wrapped in Tooltip / TooltipTrigger asChild / TooltipContent side="bottom", and its title is removed. aria-label="Refresh suggestions" stays as the accessible name. The title was never the only name.
  • A sizing catch. TooltipTrigger asChild replaces the Button's data-slot="button" with data-slot="tooltip-trigger". The phone rule in styles.css (@media (max-width: 499px)) uses [data-slot="button"] svg.lucide to draw bare button glyphs at 20px. Without that attribute, the icon dropped to 18px on phones. The first After capture showed this. The icon now carries size-4, which the same rule also covers (svg.lucide.size-4), so it is 16px on desktop and 20px on phones, as before. This is the first Button inside a TooltipTrigger in Studio. Later PRs for Studio: move native title tooltips on controls to the Tooltip primitive #2341 that wrap a Button hit the same issue.

Every occurrence

title= in non-test files under the four folders on main (4aa238f3c): 22.

Occurrence (apps/web/src/features/, line on main) Element Decision
learning/learning-settings-page.tsx:276 <Button> (icon-only Refresh suggestions) Changed → Tooltip. An interactive control; aria-label keeps the name.
memory/memory-fact-detail.tsx:208 <time title={revision.updatedAt}> Kept: non-interactive text. It discloses the full timestamp, can't take focus, and a Tooltip trigger would have to make it focusable.
search/global-search.tsx:485 <CommandDialog title="Search Mecatl"> Kept: a component prop. It renders the dialog's DialogTitle (its accessible name), not a tooltip.
knowledge/knowledge-workspace.tsx:88 <StateCard title=…> Kept: a component prop (the card heading).
knowledge/configured-skill-detail.tsx:49 <DetailState title=…> Kept: a component prop (the state heading).
knowledge/configured-skill-detail.tsx:53 <DetailState title=…> Kept: a component prop (the state heading).
learning/learning-mode-section.tsx:15 <SettingsCard title=…> Kept: a component prop (the card heading).
learning/learning-settings-page.tsx:114 <SettingsCard title=…> Kept: a component prop (the card heading).
learning/learning-settings-page.tsx:121 <SettingsCard title=…> Kept: a component prop (the card heading).
learning/learning-settings-page.tsx:242 <SettingsCard title=…> Kept: a component prop (the card heading).
learning/learning-settings-page.tsx:416 <SettingsCard title=…> Kept: a component prop (the card heading).
memory/memory-stores.tsx:22 <SettingsCard title=…> Kept: a component prop (the card heading).
memory/facts-about-you.tsx:85 <SettingsCard title=…> Kept: a component prop (the card heading).
memory/consolidate-memory-card.tsx:270 <SettingsCard title=…> Kept: a component prop. The file is also in open PR #2334.
knowledge/learned-skills.tsx:63 <span title={absolute}> (relative time) Skipped: file is in open PR #2352. It is non-interactive text, so it would stay anyway.
knowledge/learned-skills.tsx:153 <StateCard title=…> Skipped: file is in open PR #2352. A component prop, so it would stay anyway.
knowledge/learned-skills.tsx:173 <StateCard title=…> Skipped: file is in open PR #2352. A component prop, so it would stay anyway.
learning/proposal-row.tsx:238 <Button title={blockedReason}> (Approve) Skipped: file is in open PR #2352. A candidate for later; see the note below.
learning/proposal-row.tsx:260 <Button title={undoReason}> (Undo approval) Skipped: file is in open PR #2352. A candidate for later; see the note below.
memory/consolidate-memory-card.tsx:308 <Button title={generateBlocked}> Skipped: file is in open PR #2334. A candidate for later; see the note below.
memory/consolidate-memory-card.tsx:429, :437 <Button title={applyBlocked}>, <Button title={dismissBlocked}> Skipped: file is in open PR #2334. A candidate for later; see the note below.

Note for the skipped buttons. Each one explains why the button is disabled, and the title shows only while it is. A disabled <button> gets no pointer or focus events, so a Tooltip on the button itself would never open. Those need a focusable wrapper, or the reason as visible text, once #2334 and #2352 merge. Because of these skipped sites, this PR doesn't close #2341.

Behaviour differences

  • The label now also opens on keyboard focus, and it opens at once instead of after the browser's native delay. Hovering opens it too. Escape or moving away closes it.
  • While a refresh runs, the button is disabled and shows no tooltip. Its spinning icon is the feedback. The native title had the same limit in most browsers.
  • The accessible name is unchanged. Radix adds aria-describedby only while the tooltip is open.

No regression

  • Pins first (b4df832b2), against the unchanged code: learning-settings-page.pinning.test.tsx gains "names the icon-only refresh button and restarts the queue, clearing the notice". It finds the button by its accessible name, checks it has no visible text, and checks that clicking it clears a conflict notice and refetches the queue from the first page. On main's component the file passes 15/15.

  • Change (3d35d3053): two new tests in the same file, so it passes 17/17. No existing assertion was changed.

    • On hover, the Tooltip opens with "Refresh suggestions", there is no title attribute, and the glyph still matches the phone sizing rule's selectors. Escape closes the tooltip.
    • On keyboard focus, the Tooltip opens, and it closes on blur.
  • Mutation proof. Each mutation was applied alone and the focused file rerun:

    Mutation Failing tests
    main's component (native title, no Tooltip) 2 (hover, focus)
    Tooltip kept, aria-label removed 3 (pin, hover, focus)
    Icon's size-4 removed (the phone shrink) 1 (hover, glyph rule)
  • Gates (through the shared lock, on the rebased head):

Screenshots

Before = 4aa238f (main), After = e29e8e2 (the same change before rebasing onto #2355, with the same component code), Prototype = stack-08. The offline Playwright fixtures were captured twice per tree.

  • Without a tooltip, Before and After are pixel-identical, apart from a 2×3 px antialiasing speck in desktop dark that also differs between two After runs.
  • With a tooltip, the only difference is the tooltip.
  • Native tooltips don't show in screenshots. The browser draws a native title outside the page, so it never appears in a Playwright capture. That is why the Before and Prototype columns show no tooltip on hover. The prototype still uses a native title on this button. After deliberately differs from the prototype here, following Studio: use shadcn/ui primitives like the prototype and SEP (no custom components) #2201: Tooltip is the shadcn primitive that both the prototype and SEP provide.

Hover, desktop light (zoomed). After shows the Tooltip. Before and Prototype rely on the native title, which doesn't appear in captures.

hover detail light

Keyboard focus, phone light. After shows the Tooltip below the button. A native title never opens on focus.

focus mobile light

At rest, desktop light. This frame is unchanged and matches the prototype's layout. The prototype's copy and filters differ, as they already did before this PR.

rest desktop light

All other frames

Hover, desktop light and dark (full page):



Keyboard focus, desktop light and dark:




Keyboard focus, phone dark:

At rest, desktop dark and phone light and dark (unchanged; the phone frames confirm the icon is still 20px):



🤖 Generated with Claude Code

peppescg and others added 2 commits October 15, 2026 15:29
Pins, against the unchanged code, that the icon-only Refresh suggestions
button keeps its accessible name, restarts the suggestion queue and clears
a conflict notice, before its native title moves to the Tooltip primitive.

Refs #2341

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…imitive

The icon-only Refresh suggestions button in Settings > Learning explained
itself with a native title. It now uses the Tooltip primitive, which also
opens on keyboard focus, and keeps aria-label as its accessible name.

TooltipTrigger asChild replaces the Button's data-slot="button", which the
phone rule in styles.css uses to draw bare button glyphs at 20px, so the
icon shrank to 18px on phones. The icon now names size-4, which that rule
also covers, so it keeps its size at every width.

Tests prove the tooltip opens on hover and on focus, that the native title
is gone, and that the glyph still matches the phone sizing rule.

The other title= occurrences in knowledge/, learning/, search/ and
memory/ stay: component props, non-interactive text, or files in open
PRs (#2334, #2352).

Refs #2341

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@kantord kantord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, and thanks for catching the data-slot sizing issue and fixing it with size-4. I checked it against styles.css: svg.lucide.size-4 is in the phone rule, so the 16px/20px sizes hold. Approving, with a few non-blocking nits:

  • learning-settings-page.pinning.test.tsx copies the phone-glyph selector from styles.css as a string literal. If the CSS changes, the test stays green and stops proving anything. Reading the rule from styles.css (or asserting size-4 directly) would be sturdier.
  • The tooltip text matches the aria-label, so a screen reader may announce it twice while the tooltip is open. This is the usual icon-button pattern, so low priority.
  • The root cause looks broader than this button: asChild triggers replace a Button's data-slot="button", so any phone rule keyed on it misses them. I believe schedule-detail.tsx has the same pattern with a bare icon. A follow-up issue for a fix in Button or the CSS seems worthwhile rather than a per-site size-4.

Fully or partially written by an AI agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio: move native title tooltips on controls to the Tooltip primitive

2 participants