fix(Tooltip): wrap unbreakable content - #1346
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6fb2525 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📦 NPM canary releaseDeployed canary version 0.0.0-canary-1d27aa0. |
Contributor
🏋️ Size limit report
Compared against main at 4afd730 — run 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. |
Contributor
🧪 Storybook is successfully deployed!
|
Merged
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.
Fixes CUB-4036.
Problem
Tooltipcaps its width atmin(36x, 100dvw - 4x)withmax-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:browseron a 106-character identifier: the content box was 304px wide while its text ran 673.8px — ~370px of overflow.Fix
overflow-wrap: anywhereon the tooltip root. Same propertyPrismCodealready 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.tsx—overflowWrap: 'anywhere'Tooltip.stories.tsx—UnbreakableContentstory with aplayfunction, so Chromatic captures the open tooltipTooltip.docs.mdx— "Long Content" section documenting the width cap and the mid-word breakpnpm 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)withmax-content, butwhite-space: pre-linenever broke inside a word.Sets
overflowWrap: 'anywhere'on the tooltip root (inherits to children). Short copy still shrinks tomax-content. Adds anUnbreakableContentstory 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.