Skip to content

fix(ui): prevent long messages from overflowing chat bubbles#1590

Merged
esengine merged 1 commit into
esengine:mainfrom
yvone1991:fix/desktop-user-message-wrap
May 24, 2026
Merged

fix(ui): prevent long messages from overflowing chat bubbles#1590
esengine merged 1 commit into
esengine:mainfrom
yvone1991:fix/desktop-user-message-wrap

Conversation

@yvone1991

@yvone1991 yvone1991 commented May 23, 2026

Copy link
Copy Markdown

What

Updates the desktop and dashboard message styles so long unbroken user-visible text, such as Windows paths, URLs, and long tokens, wraps inside chat bubbles instead of stretching the layout.

Changes

  • Rebased on the latest upstream main.
  • Mirrored the wrapping fix in both desktop/src/styles.css and dashboard/src/styles.css.
  • Removed the now-redundant user-specific white-space: pre-wrap rule added by fix(ui): preserve user message newlines #1588, since .msg-text now carries that behavior directly.
  • Dropped the newly added word-break: break-word usage and rely on the standardized overflow-wrap: anywhere.
  • Updated tests/user-message-newlines.test.ts so it checks the broader shared message-text rules instead of the removed user-specific selector.

Verification

  • Ran npm run verify
  • Result: build, lint, typecheck, and tests passed

@esengine

Copy link
Copy Markdown
Owner

Thanks — the CSS logic is right. I traced the cascade for both user and assistant messages:

  • User: <div class="msg-text">{text}</div>pre-wrap + overflow-wrap: anywhere apply, long unbroken strings break. ✓
  • Assistant: <div class="msg-text"><div class="markdown">…</div></div> → the outer .msg-text gets pre-wrap, the inner .markdown resets to normal, so markdown semantic whitespace is preserved. Inner <p>/<code>/<a> pick up overflow-wrap: anywhere via the existing combined selectors. ✓

One blocker, plus two follow-on notes.

Blocker — dashboard not touched, symmetry with #1588 broken

The same vulnerability lives in dashboard/src/styles.css — the .msg-text / .markdown block structure is mirrored across desktop and dashboard. #1588 (merged about 30 minutes before this PR was opened) fixed both sides for the newlines case, which is the established repo pattern. Long file paths / URLs still blow out the user bubble on the web dashboard with this PR's current scope.

Please mirror the same 16 lines into dashboard/src/styles.css at the equivalent location. Same selectors, same rules.

Follow-on notes (optional but recommended in the same revision)

  1. Overlap with fix(ui): preserve user message newlines #1588. fix(ui): preserve user message newlines #1588 added this to both desktop/src/styles.css and dashboard/src/styles.css:

    .msg.user .msg-text,
    .msg.user .msg-text.user-pending {
      white-space: pre-wrap;
    }

    Once this PR lifts white-space: pre-wrap onto the broader .msg-text selector, the fix(ui): preserve user message newlines #1588 rule becomes a redundant subset (same property, lower specificity but same effect). Behavior doesn't change either way, but it's worth deleting those 4 lines in both files while you're rebasing on current main, so the next reader doesn't have to figure out why both rules exist. git pull origin main will surface them.

  2. word-break: break-word is a deprecated alias. overflow-wrap: anywhere covers the same case and is the standardized form (Chrome 80+ / Firefox 65+ / Safari 15+, all well within Tauri WebView and Vite/dashboard's browser baseline). Keeping both is harmless but noisy — you can drop word-break: break-word everywhere it's added. No strong opinion if you'd rather keep belt-and-suspenders.

Push a fixup with the dashboard parity (and optionally the cleanups) and I'll merge.

@yvone1991 yvone1991 force-pushed the fix/desktop-user-message-wrap branch from 072a91e to 4fba955 Compare May 24, 2026 08:12
@yvone1991 yvone1991 changed the title fix(desktop): prevent long user messages from overflowing chat bubbles fix(ui): prevent long messages from overflowing chat bubbles May 24, 2026

Copy link
Copy Markdown
Author

Thanks for the review. I pushed an update that rebases on latest main, mirrors the wrapping rules into dashboard/src/styles.css, removes the redundant user-specific pre-wrap rule from both CSS files, drops the newly added word-break: break-word, and updates tests/user-message-newlines.test.ts to assert the broader shared .msg-text behavior.

Verified with npm run verify.

@esengine esengine merged commit 1dc54df into esengine:main May 24, 2026
4 checks passed
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