Skip to content

feat(EllipsisContent): show Click UI Tooltip on overflow instead of title attribute#1137

Open
DreaminDani wants to merge 1 commit into
mainfrom
ellipsis-content-tooltip
Open

feat(EllipsisContent): show Click UI Tooltip on overflow instead of title attribute#1137
DreaminDani wants to merge 1 commit into
mainfrom
ellipsis-content-tooltip

Conversation

@DreaminDani

@DreaminDani DreaminDani commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What

Per @ariser 's request, EllipsisContent now shows the Click UI Tooltip with the full text when its content is truncated, instead of setting the native title attribute.

Why

The native title tooltip is unstyled, slow to appear, and inconsistent with the rest of the design system. Using the Click UI Tooltip gives truncated content a styled, on-brand tooltip on hover.

CleanShot 2026-07-02 at 16 35 17@2x

How

  • EllipsisContent.tsx — the ref still measures scrollWidth > clientWidth, but instead of writing node.title it 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 so react-hooks/rules-of-hooks recognizes it as a component now that it uses useState.
  • Tooltip.tsx / Tooltip.types.ts — added an asChild prop to Tooltip.Trigger. This is required: the trigger otherwise wraps children in an extra <div>, which would break the ellipsis in flex consumers like IconWrapper (the EllipsisContent element needs to be the direct flex child to shrink and truncate). With asChild, 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 no title is set; non-truncated → no tooltip and no title.

Testing

Ran the affected visual specs in Docker against the committed baselines:

  • EllipsisContent: 10/10 pass — the 8 static screenshots match existing baselines unchanged (the tooltip is portaled and only appears on hover, so it's visually inert), plus both new behavioral tests. No baselines needed regenerating.
  • Table (a consumer): all pass, including long-text-truncated and column-level-truncation.
  • Tooltip: all pass — the asChild addition didn't disturb existing behavior.
  • Typecheck / ESLint / Prettier clean.

Note: CI's affected-specs resolver runs the full visual suite here because EllipsisContent/Tooltip are shared components.

🤖 Generated with Claude Code

…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-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e445946

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Minor

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

@DreaminDani DreaminDani requested a review from ariser July 2, 2026 22:39
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Storybook Preview Deployed

✅ Preview URL: https://click-kglx29poe-clickhouse.vercel.app

Built from commit: d893c9c96d5a4fd6007e6d6258e0bc274a1498e0

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