Skip to content

fix(diagram): handle text overflow in popover and element details#2894

Merged
davydkov merged 1 commit into
mainfrom
fix/overflow-long-names
Apr 15, 2026
Merged

fix(diagram): handle text overflow in popover and element details#2894
davydkov merged 1 commit into
mainfrom
fix/overflow-long-names

Conversation

@ckeller42

@ckeller42 ckeller42 commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

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-test model using automotive-style long identifiers.

Changes

Relationship popover overflow

  • Endpoint badges: truncated with ellipsis at 160px (tooltip shows full FQN)
  • RelationshipTitle: word-break: break-word + overflow-wrap: anywhere
  • Kind/technology labels: word-break: break-word + minWidth: 0

Element details card title overflow

  • Title: line-clamp: 2 with word-break: break-word, full text via tooltip
  • Flex container: minWidth: 0 + overflow: hidden on icon+title wrapper
  • Tags container: minWidth: 0 + overflow: hidden

Relationship-details overlay edge label overflow

  • EdgeLabelContainer: Stop dropping the style prop — merge contentStyle with labelBBox (labelBBox wins precedence)
  • globalCss: CSS fallback max-width: 350px + line-clamp: 1 for .likec4-relationship-details
  • edgeLabel recipe: overflowWrap: 'anywhere' on label and technology text
  • layout.ts: Dagre edgeLabel.height 14 → 55 for proper vertical spacing

Test plan

  • likec4 start examples/overflow-test → navigate to sensorPipeline view
  • Click [...] edge label → verify relationship titles wrap in popover
  • Click "browse relationships" → verify edge labels constrained, truncated, no overlap
  • Click element details on outputSelector node → verify title clamped to 2 lines
  • Hover clamped title → verify tooltip shows full name
  • Verify main diagram edge labels unaffected

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Apr 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0e786b8

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

This PR includes changesets to release 21 packages
Name Type
@likec4/diagram Patch
@likec4/playground Patch
likec4 Patch
@likec4/react Patch
@likec4/vscode-preview Patch
likec4-vscode Patch
@likec4/docs-astro Patch
@likec4/style-preset Patch
@likec4/styles Patch
@likec4/config Patch
@likec4/core Patch
@likec4/generators Patch
@likec4/language-server Patch
@likec4/language-services Patch
@likec4/layouts Patch
@likec4/leanix-bridge Patch
@likec4/log Patch
@likec4/lsp Patch
@likec4/mcp Patch
@likec4/tsconfig Patch
@likec4/vite-plugin 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

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Fixes 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

Cohort / File(s) Summary
Changeset
.changeset/fix-overflow-long-names.md
Add patch release entry documenting overflow/wrapping fixes.
Relationship popover
packages/diagram/src/likec4diagram/relationship-popover/RelationshipPopover.tsx, packages/diagram/src/likec4diagram/relationship-popover/components.tsx
Add wrapping/min-width constraints (wordBreak: 'break-word', overflowWrap: 'anywhere', minWidth: 0) and set endpoint ellipsis (overflow: hidden, textOverflow: 'ellipsis', maxWidth: 160px).
Element details card
packages/diagram/src/overlays/element-details/ElementDetailsCard.css.ts, packages/diagram/src/overlays/element-details/ElementDetailsCard.tsx
Enforce truncated title rendering (overflow: hidden, textOverflow: 'ellipsis', wordBreak: 'break-word', lineClamp: 2), add minWidth: 0/overflow: hidden containers, and render title inside a Tooltip.
Edge label rendering & styles
packages/diagram/src/base-primitives/edge/EdgeLabelContainer.tsx, styled-system/preset/src/recipes/edgeLabel.ts, styled-system/preset/src/globalCss.ts
Preserve/merge incoming style into inner label and always merge optional maxWidth; add overflowWrap: 'anywhere' to edge label styles; add global CSS to cap label width and apply WebKit single-line clamping for edge label text within the relationship-details overlay.
Layout sizes
packages/diagram/src/overlays/relationship-details/layout.ts
Increase Sizes.edgeLabel.height from 14 to 55 (affects Dagre edge label bbox/layout), add SPDX header, and remove commented legacy sizes.
Examples & tests
examples/overflow-test/model.c4, examples/overflow-test/likec4.config.json, packages/likec4/src/LikeC4.spec.ts
Add synthetic C4 model and project config to reproduce overflow scenarios; update test snapshot to include the new overflow-test project.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • davydkov
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing text overflow issues in diagram components (popover and element details).
Description check ✅ Passed The description is comprehensive, covering summary, detailed changes across three areas, and a test plan. However, test plan checkboxes remain unchecked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/overflow-long-names

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

Screenshots (synthetic test model — non-confidential)

Pattern 8: Relationship popover with long names (After fix)

Long relationship titles like IMAGE_NATIVE_PROCESSED -> IMAGE_NATIVE_PROCESSED :dwImageHandle_t now wrap correctly within the popover. Endpoint badges truncate with ellipsis at 160px and show full FQN via tooltip on hover.

Pattern 9: Element details card with long name and multiple tags (After fix)

The title OutputSelectorDispatcherNode is properly contained within the header. Tags (#sensor, #dataProcessing, #plugin, #graphlet) display inline without overflowing.


Screenshots taken from synthetic examples/overflow-test model. Will attach images in follow-up comment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
examples/overflow-test/model.c4 (1)

72-105: Consider adding one no-whitespace technology token to harden the regression case.

Current technology samples 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

📥 Commits

Reviewing files that changed from the base of the PR and between c78354e and 158585f.

⛔ Files ignored due to path filters (6)
  • .github/pr-assets/overflow-test-view.png is excluded by !**/*.png
  • .github/pr-assets/pattern8-popover-after.png is excluded by !**/*.png
  • .github/pr-assets/pattern8-popover-before.png is excluded by !**/*.png
  • .github/pr-assets/pattern8-popover-multi-after.png is excluded by !**/*.png
  • .github/pr-assets/pattern9-details-after.png is excluded by !**/*.png
  • .github/pr-assets/pattern9-details-before.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • examples/overflow-test/model.c4

@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch 3 times, most recently from ddc10db to dea6b55 Compare April 14, 2026 16:38
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch from dea6b55 to f66498b Compare April 14, 2026 16:56
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch from f66498b to 27a6e49 Compare April 14, 2026 17:18
@ckeller42 ckeller42 requested a review from davydkov April 14, 2026 17:18
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch from 27a6e49 to ccb998f Compare April 14, 2026 18:03
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between dea6b55 and ccb998f.

⛔ Files ignored due to path filters (8)
  • .github/pr-assets/overflow-test-view.png is excluded by !**/*.png
  • .github/pr-assets/pattern8-popover-after.png is excluded by !**/*.png
  • .github/pr-assets/pattern8-popover-before.png is excluded by !**/*.png
  • .github/pr-assets/pattern8-popover-multi-after.png is excluded by !**/*.png
  • .github/pr-assets/pattern9-details-after.png is excluded by !**/*.png
  • .github/pr-assets/pattern9-details-before.png is excluded by !**/*.png
  • .github/pr-assets/rel-details-after.png is excluded by !**/*.png
  • .github/pr-assets/rel-details-before.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • .changeset/fix-overflow-long-names.md
  • examples/overflow-test/likec4.config.json
  • examples/overflow-test/model.c4
  • packages/diagram/src/base-primitives/edge/EdgeLabelContainer.tsx
  • packages/diagram/src/likec4diagram/relationship-popover/RelationshipPopover.tsx
  • packages/diagram/src/likec4diagram/relationship-popover/components.tsx
  • packages/diagram/src/overlays/element-details/ElementDetailsCard.css.ts
  • packages/diagram/src/overlays/element-details/ElementDetailsCard.tsx
  • packages/diagram/src/overlays/relationship-details/layout.ts
  • packages/likec4/src/LikeC4.spec.ts
  • styled-system/preset/src/globalCss.ts
  • styled-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

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch from ccb998f to 8387ab3 Compare April 14, 2026 18:11
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch from 8387ab3 to 4795fc8 Compare April 14, 2026 18:15
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…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>
@ckeller42 ckeller42 force-pushed the fix/overflow-long-names branch from 4795fc8 to 0e786b8 Compare April 14, 2026 18:20
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.

2 participants