Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 3eb067e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
With asChild, Tooltip.Trigger dropped every prop it was given, and as a plain function component it dropped its ref in both modes. It now forwards the ref and passes its props through Radix Slot, so they reach the child (with asChild) or the wrapper div (without it). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ariser
force-pushed
the
nick/tooltip-trigger-as-child
branch
from
October 7, 2026 18:03
6539007 to
3eb067e
Compare
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-6jbazf5v9-clickhouse.vercel.app Built from commit: |
Contributor
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
ariser
marked this pull request as ready for review
October 7, 2026 18:36
DreaminDani
approved these changes
Oct 7, 2026
4 of 8 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Tooltip.Triggernow forwards itsref. Before, it was a plain function component, so arefwas dropped with and withoutasChild.asChild, the props given toTooltip.Trigger(event handlers,aria-*,data-*,className,style) now reach the child element. Before, only the child's own props survived. The props and the ref go through RadixSlot, which merges event handlers, class names, styles and refs with the child's own.asChild, the wrapper<div>gets the props as before, and now the ref too. The markup does not change.HTMLElement, because withasChildit lands on the consumer's element, whatever its tag.TooltipTriggerPropsis unchanged.Links and tickets
CUI-326. Related: #1257. With both,
Dropdown.Item asChildcan be the child ofTooltip.Trigger asChild.Good to know
Tooltip.Trigger asChildas theasChildchild of another Radix part (for example insideDropdown.Item asChild), so consumers no longer need a controlled tooltip as a workaround.asChild, the trigger is a non-focusable<div>, so keyboard users cannot open the tooltip. That is a markup and accessibility change for a follow-up PR.@radix-ui/react-slotis already a direct dependency.Tests
Tooltip.test.tsx:Tooltip.Triggerpasses its props and ref to the child withasChild, and to the wrapper element without it.{...props}→{...(asChild ? {} : props)}cloneElement(children, props), which overwrites the child'sonClickref={asChild ? undefined : ref}{...(asChild ? props : {})}ref={asChild ? ref : undefined}Checklist
Contribution
buildandbuild-storybookwork locallyAccessibility
No markup, styles or ARIA changed. Props such as
aria-*that a consumer gives toTooltip.Trigger asChildnow reach the child (WCAG 4.1.2 Name, Role, Value). Not tested: a manual keyboard pass and the Storybook axe panel.Screenshots
None: there is no visual change.
yarn test:visual Tooltip(7) andEllipsisContent(11) pass with no snapshot changes.🤖 Generated with Claude Code