fix(diagram): handle text overflow in popover and element details#2894
Conversation
🦋 Changeset detectedLatest commit: 0e786b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
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 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughFixes text overflow, wrapping, and truncation for long element names, relationship titles, endpoints, technologies, and edge labels across the diagram package; adds a changeset and example model to reproduce overflow scenarios. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Screenshots (synthetic test model — non-confidential)Pattern 8: Relationship popover with long names (After fix)Long relationship titles like Pattern 9: Element details card with long name and multiple tags (After fix)The title Screenshots taken from synthetic |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
examples/overflow-test/model.c4 (1)
72-105: Consider adding one no-whitespacetechnologytoken to harden the regression case.Current
technologysamples are long, but mostly space-delimited. Adding one intentionally unbroken long token (e.g., a single FQN-style string) would better validate worst-case wrapping/overflow behavior for kind/technology rendering.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@examples/overflow-test/model.c4` around lines 72 - 105, Add a single no-whitespace, very long token to one of the technology strings to exercise wrapping/overflow (for example in the technology value on the outputSelector -> objectDetector edge or any other outputSelector mapping shown). Locate the technology lines such as the ones in the edges rawFrameDecoder -> outputSelector, outputSelector -> objectDetector, or outputSelector -> sceneClassifier and append or replace with a hard-to-break token (a long FQN-style string with no spaces) in the quoted technology value so the renderer must handle an unbroken token.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@examples/overflow-test/model.c4`:
- Around line 72-105: Add a single no-whitespace, very long token to one of the
technology strings to exercise wrapping/overflow (for example in the technology
value on the outputSelector -> objectDetector edge or any other outputSelector
mapping shown). Locate the technology lines such as the ones in the edges
rawFrameDecoder -> outputSelector, outputSelector -> objectDetector, or
outputSelector -> sceneClassifier and append or replace with a hard-to-break
token (a long FQN-style string with no spaces) in the quoted technology value so
the renderer must handle an unbroken token.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f34bc7c9-2f58-4d04-9b66-1bab97dda3a6
⛔ Files ignored due to path filters (6)
.github/pr-assets/overflow-test-view.pngis excluded by!**/*.png.github/pr-assets/pattern8-popover-after.pngis excluded by!**/*.png.github/pr-assets/pattern8-popover-before.pngis excluded by!**/*.png.github/pr-assets/pattern8-popover-multi-after.pngis excluded by!**/*.png.github/pr-assets/pattern9-details-after.pngis excluded by!**/*.png.github/pr-assets/pattern9-details-before.pngis excluded by!**/*.png
📒 Files selected for processing (1)
examples/overflow-test/model.c4
ddc10db to
dea6b55
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
dea6b55 to
f66498b
Compare
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
f66498b to
27a6e49
Compare
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
27a6e49 to
ccb998f
Compare
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
styled-system/preset/src/globalCss.ts (1)
76-87: Consider consolidating duplicated clamp rules into one selector.Both blocks are identical; combining them will reduce maintenance overhead without changing behavior.
♻️ Proposed refactor
- '.likec4-relationship-details .likec4-edge-label__text': { - display: '-webkit-box!', - WebkitBoxOrient: 'vertical!', - WebkitLineClamp: '1!', - overflow: 'hidden!', - }, - '.likec4-relationship-details .likec4-edge-label__technology': { + '.likec4-relationship-details :is(.likec4-edge-label__text, .likec4-edge-label__technology)': { display: '-webkit-box!', WebkitBoxOrient: 'vertical!', WebkitLineClamp: '1!', overflow: 'hidden!', },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@styled-system/preset/src/globalCss.ts` around lines 76 - 87, Consolidate the duplicated CSS rule blocks for the selectors '.likec4-relationship-details .likec4-edge-label__text' and '.likec4-relationship-details .likec4-edge-label__technology' into a single rule that targets both selectors (e.g. comma-separated selector list) and keep the same declarations (display, WebkitBoxOrient, WebkitLineClamp, overflow) so behavior doesn't change; update the single rule where these selectors are defined in globalCss.ts (preserve the existing property values and any special tokens like the trailing '!' if they are meaningful).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@styled-system/preset/src/globalCss.ts`:
- Around line 76-87: Consolidate the duplicated CSS rule blocks for the
selectors '.likec4-relationship-details .likec4-edge-label__text' and
'.likec4-relationship-details .likec4-edge-label__technology' into a single rule
that targets both selectors (e.g. comma-separated selector list) and keep the
same declarations (display, WebkitBoxOrient, WebkitLineClamp, overflow) so
behavior doesn't change; update the single rule where these selectors are
defined in globalCss.ts (preserve the existing property values and any special
tokens like the trailing '!' if they are meaningful).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 54765db2-a0a7-4a46-ab79-639ae8c46511
⛔ Files ignored due to path filters (8)
.github/pr-assets/overflow-test-view.pngis excluded by!**/*.png.github/pr-assets/pattern8-popover-after.pngis excluded by!**/*.png.github/pr-assets/pattern8-popover-before.pngis excluded by!**/*.png.github/pr-assets/pattern8-popover-multi-after.pngis excluded by!**/*.png.github/pr-assets/pattern9-details-after.pngis excluded by!**/*.png.github/pr-assets/pattern9-details-before.pngis excluded by!**/*.png.github/pr-assets/rel-details-after.pngis excluded by!**/*.png.github/pr-assets/rel-details-before.pngis excluded by!**/*.png
📒 Files selected for processing (12)
.changeset/fix-overflow-long-names.mdexamples/overflow-test/likec4.config.jsonexamples/overflow-test/model.c4packages/diagram/src/base-primitives/edge/EdgeLabelContainer.tsxpackages/diagram/src/likec4diagram/relationship-popover/RelationshipPopover.tsxpackages/diagram/src/likec4diagram/relationship-popover/components.tsxpackages/diagram/src/overlays/element-details/ElementDetailsCard.css.tspackages/diagram/src/overlays/element-details/ElementDetailsCard.tsxpackages/diagram/src/overlays/relationship-details/layout.tspackages/likec4/src/LikeC4.spec.tsstyled-system/preset/src/globalCss.tsstyled-system/preset/src/recipes/edgeLabel.ts
✅ Files skipped from review due to trivial changes (6)
- examples/overflow-test/likec4.config.json
- .changeset/fix-overflow-long-names.md
- styled-system/preset/src/recipes/edgeLabel.ts
- packages/diagram/src/overlays/element-details/ElementDetailsCard.tsx
- packages/diagram/src/likec4diagram/relationship-popover/RelationshipPopover.tsx
- examples/overflow-test/model.c4
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/diagram/src/overlays/relationship-details/layout.ts
- packages/diagram/src/base-primitives/edge/EdgeLabelContainer.tsx
- packages/diagram/src/likec4diagram/relationship-popover/components.tsx
|
@coderabbitai review |
ccb998f to
8387ab3
Compare
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
8387ab3 to
4795fc8
Compare
✅ Actions performedReview triggered.
|
…etails, and relationship-details overlay - Relationship popover: word-break + overflow-wrap on titles, truncate endpoint badges - Element details card: line-clamp title to 2 lines, flex overflow fixes - Relationship-details overlay: EdgeLabelContainer merges contentStyle with labelBBox (labelBBox wins precedence), CSS fallback max-width 350px + line-clamp for edge labels, dagre height 14→55 - Edge label recipe: overflowWrap 'anywhere' for label and technology text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4795fc8 to
0e786b8
Compare
Summary
Fix text overflow in relationship popover, element details card, and relationship-details overlay when displaying long element names, relationship titles, and technology strings.
Tested with a synthetic
examples/overflow-testmodel using automotive-style long identifiers.Changes
Relationship popover overflow
word-break: break-word+overflow-wrap: anywhereword-break: break-word+minWidth: 0Element details card title overflow
line-clamp: 2withword-break: break-word, full text via tooltipminWidth: 0+overflow: hiddenon icon+title wrapperminWidth: 0+overflow: hiddenRelationship-details overlay edge label overflow
styleprop — mergecontentStylewithlabelBBox(labelBBox wins precedence)max-width: 350px+line-clamp: 1for.likec4-relationship-detailsoverflowWrap: 'anywhere'on label and technology textedgeLabel.height14 → 55 for proper vertical spacingTest plan
likec4 start examples/overflow-test→ navigate tosensorPipelineview[...]edge label → verify relationship titles wrap in popoveroutputSelectornode → verify title clamped to 2 lines🤖 Generated with Claude Code