Skip to content

fix(Tooltip): wrap unbreakable content - #1346

Merged
tenphi merged 1 commit into
mainfrom
fix/cub-4036-tooltip-wrapping
Aug 24, 2026
Merged

fix(Tooltip): wrap unbreakable content#1346
tenphi merged 1 commit into
mainfrom
fix/cub-4036-tooltip-wrapping

Conversation

@tenphi

@tenphi tenphi commented Aug 24, 2026

Copy link
Copy Markdown
Member

Fixes CUB-4036.

Problem

Tooltip caps its width at min(36x, 100dvw - 4x) with max-width: max-content, but never allowed a break inside a word. A run with no spaces — a URL, a token, an identifier, an error string — stayed on one line and spilled straight out of the bubble.

Measured with pnpm probe:browser on a 106-character identifier: the content box was 304px wide while its text ran 673.8px — ~370px of overflow.

Fix

overflow-wrap: anywhere on the tooltip root. Same property PrismCode already uses for its wrapped mode. It inherits, so tooltip children wrap too.

After the fix, the same case measures 287.9px of text inside a 288px content box (3 lines). Short tooltips are unchanged — they still shrink to max-content (66px for "Short tip").

Changes

  • Tooltip.tsxoverflowWrap: 'anywhere'
  • Tooltip.stories.tsxUnbreakableContent story with a play function, so Chromatic captures the open tooltip
  • Tooltip.docs.mdx — "Long Content" section documenting the width cap and the mid-word break
  • changeset (patch)

pnpm test: 2093 passed, 1 skipped.

🤖 Generated with Claude Code


Note

Low Risk
CSS-only wrapping change on Tooltip plus docs/story coverage; short tooltips still shrink to content.

Overview
Stops Tooltip overflow when the title is a long unbreakable string (URL, token, identifier, error). The bubble already caps at min(36x, 100dvw - 4x) with max-content, but white-space: pre-line never broke inside a word.

Sets overflowWrap: 'anywhere' on the tooltip root (inherits to children). Short copy still shrinks to max-content. Adds an UnbreakableContent story and a Long Content docs section.

Reviewed by Cursor Bugbot for commit 6fb2525. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6fb2525

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

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Patch

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

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cube-ui-kit Ready Ready Preview Aug 24, 2026 2:18pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📦 NPM canary release

Deployed canary version 0.0.0-canary-1d27aa0.

@github-actions

Copy link
Copy Markdown
Contributor

🏋️ Size limit report

Name Size Passed?
All 498 KB (+0.01% 🔺) Yes 🎉
Tree shaking (just a Button) 121.13 KB (+0.02% 🔺) Yes 🎉

Compared against main at 4afd730run 32492162650, 2026-08-21T14:26:38Z.

To see which modules changed, download the size-limit-statoscope-report artifact from this run and open report.html.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Storybook is successfully deployed!

@tenphi
tenphi merged commit 3e5e3fe into main Aug 24, 2026
16 checks passed
@tenphi
tenphi deleted the fix/cub-4036-tooltip-wrapping branch August 24, 2026 14:32
@tenphi tenphi mentioned this pull request Aug 24, 2026
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