Make the agent use the existing Tooltip primitive, not a title attribute or a new overlay

2026-11-24来源 dev.toEnglish

The PR adds a hint with a native title attribute, or a position: absolute hover div next to the control. The repo already has a Tooltip primitive with a delay, a portal, focus and hover bindings, and a labelled content node. The new hint is slow to appear on hover, disappears before it can be read, and never shows on keyboard focus.

I've started treating a title attribute or a homemade hover box as incomplete when a Tooltip primitive exists. The label is the easy part. Delay, overflow, and keyboard access are why the primitive is there.

Why the homemade tooltip shows up

A tutorial "tooltip" is a title attribute or a span that shows on hover. The model can write that without finding components/Tooltip. Your primitive may be named Hint, or it may wrap Radix or a design-system tooltip, which is easy to miss if the prompt only says "add a hover label."

You also skip things reviewers only catch later: show on focus, a hover grace period so the pointer can reach the content, and collision handling near the viewport edge.

A simple Tooltip policy

  • New hover or focus hints use the existing Tooltip primitive
  • Do not use title as the product tooltip
  • Do not add a one-off absolute hover div in a feature file
  • A new placement or delay is a primitive change, with a story

If the copy is essential, not a hint, put it in visible text or an accessible name. A tooltip is not a substitute for a label.

What to put in the prompt

Use the existing Tooltip primitive for this hover hint. Do not use a title attribute, and do not build a hover div in this file. Keep the control's accessible name in the control, not only in the tooltip. If you need a new placement or delay, extend the primitive; do not invent a second overlay. 

Paste one existing Tooltip usage. In review, search the diff for title=, a raw onMouseEnter popup, and a position: absolute hint that is not the primitive.

Reject / send back

Reject

  • A feature-level hover overlay that reimplements the Tooltip
  • A title attribute used as the only hint for a toolbar icon
  • A tooltip that never appears on keyboard focus
  • A second tooltip library added for one icon

Accept

  • A hint that uses the existing Tooltip primitive
  • A primitive PR that adds a documented placement or delay and a story
  • Essential copy moved into visible text or the control's accessible name

原文:https://www.a8q9.cn/en/article/make-the-agent-use-the-existing-tooltip-primitive-not-a-title-attribute-or-a-new-8345da.html

相关文章