feat(EllipsisContent): show Click UI Tooltip on overflow instead of title attribute#1137
Open
DreaminDani wants to merge 1 commit into
Open
feat(EllipsisContent): show Click UI Tooltip on overflow instead of title attribute#1137DreaminDani wants to merge 1 commit into
DreaminDani wants to merge 1 commit into
Conversation
…itle attribute When content is truncated, EllipsisContent now renders the Click UI Tooltip with the full text on hover, replacing the native `title` attribute. Adds an `asChild` prop to `Tooltip.Trigger` so the caller's own element can be the trigger without the default wrapping `div` (which would break truncation in flex consumers like IconWrapper). Updates the visual-regression spec to cover the tooltip behavior in place of the removed title-attribute assertions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: e445946 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 |
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-kglx29poe-clickhouse.vercel.app Built from commit: |
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.
What
Per @ariser 's request,
EllipsisContentnow shows the Click UITooltipwith the full text when its content is truncated, instead of setting the nativetitleattribute.Why
The native
titletooltip is unstyled, slow to appear, and inconsistent with the rest of the design system. Using the Click UITooltipgives truncated content a styled, on-brand tooltip on hover.How
EllipsisContent.tsx— the ref still measuresscrollWidth > clientWidth, but instead of writingnode.titleit stores the overflowing text in state and, when truncated, wraps the element in<Tooltip>. Non-truncated content renders bare (identical DOM to before). The inner render fn was renamed to a PascalCase name soreact-hooks/rules-of-hooksrecognizes it as a component now that it usesuseState.Tooltip.tsx/Tooltip.types.ts— added anasChildprop toTooltip.Trigger. This is required: the trigger otherwise wraps children in an extra<div>, which would break the ellipsis in flex consumers likeIconWrapper(theEllipsisContentelement needs to be the direct flex child to shrink and truncate). WithasChild, the element itself becomes the trigger, keeping the rendered DOM a single element. Backward-compatible — the default path is unchanged.tests/display/ellipsis-content.spec.ts— replaced the "Title attribute on overflow" tests (now invalid) with "Tooltip on overflow": hover a truncated element → the portaled tooltip shows the full text and notitleis set; non-truncated → no tooltip and notitle.Testing
Ran the affected visual specs in Docker against the committed baselines:
long-text-truncatedandcolumn-level-truncation.asChildaddition didn't disturb existing behavior.🤖 Generated with Claude Code