Skip to content

feat(ui): allow span tooltip triggers inside buttons - #57894

Closed
liambreen wants to merge 1 commit into
anomalyco:devfrom
liambreen:tooltip-trigger-as
Closed

liambreen wants to merge 1 commit into
anomalyco:devfrom
liambreen:tooltip-trigger-as

Conversation

@liambreen

@liambreen liambreen commented Oct 21, 2026 •

Copy link
Copy Markdown

Issue for this PR

Refs #55446 — small prep change for the tab-grouping PR that follows.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Tooltip's Kobalte trigger renders as a div, which the HTML content model forbids inside buttons. This adds an optional triggerAs prop so a call site can request a span trigger instead, and types the trigger ref as HTMLElement accordingly.

Nothing in the app uses it yet. The follow-up tab-grouping PR needs it: the horizontal group badge shows its project name on hover, and the trigger has to live inside the header button (wrapping the button itself would trip the tooltip component's expanded-disclosure suppression).

How did you verify your code works?

  • bun typecheck in packages/ui and bun run check at the repo root, both green.
  • The prop is additive with a div default, so existing call sites are untouched.

Screenshots / recordings

Non-visual API addition.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #55446

Tooltip's Kobalte trigger renders as a div, which the HTML content
model forbids inside buttons. triggerAs lets a call site request a span
trigger; upcoming tab-group badges use it to show the project name on
hover from inside their header buttons.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The change looks sound. It's additive, and with the default (div) existing tooltips render and behave as before. packages/ui type-checks with it. The ref is only used through HTMLElement methods, so widening its type is safe. The trigger's display: flex rule applies the same to a span, so layout shouldn't shift. I didn't render it, because nothing in the app uses the prop yet. Its only user is #57896, so it may be easiest to land the two together.

Public API: none affected. It adds an optional triggerAs?: "div" | "span" prop to the internal UI Tooltip component (backwards compatible); SDK, server, plugin, config and CLI are unchanged.

Related: #55446

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.

1 participant