Skip to content

[CSM][Web] Fix case detail page overflowing off-screen on wide comment content - #1424

Merged
rksk merged 3 commits into
wso2-open-operations:mainfrom
Hesara2003:fix/case-detail-overflow-html-table
Aug 11, 2026
Merged

rksk merged 3 commits into
wso2-open-operations:mainfrom
Hesara2003:fix/case-detail-overflow-html-table

Conversation

@Hesara2003

@Hesara2003 Hesara2003 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

A case comment whose body carries an explicit pixel width — what a Word/Excel paste through the comment editor's HTML source mode produces (e.g. <div style="width:2400px">) — pushed the entire case-detail page wider than the viewport. The header actions (Assign to me / Acknowledge / More), the last column of the Overview section, and the activity-timeline toolbar (Filter / Newest first) all got cut off past the right edge, on any case type.

Scope note: this fixes the containment of backend-rendered rich text on the case-detail surface. It deliberately does not touch AppShell.Main (vendored in @wso2/oxygen-ui) or add a blanket page-level clamp — the over-wide content should be contained where it enters, so wide tables stay scrollable/readable rather than being clipped app-wide.

Goals

  • Page content always fits the available width, regardless of what markup a comment body contains.
  • Over-wide content (tables, pasted spreadsheet blocks, code) stays reachable by scrolling inside the comment, not clipped away.
  • Fix holds for any element, not just the handful of tags currently special-cased.

Approach

  • src/features/csm-cases/components/CsmCaseCommentBubble.tsx — added contain: inline-size (plus max-width: 100% / overflow-x: auto) to the rich-text host.

    The existing per-tag rules (& table, & pre, & img) can't cover this, because the width can sit on any element. contain: inline-size makes the host's own width independent of its contents, so an over-wide child can no longer inflate the intrinsic min-content width that propagates up bubble → feed → tab → page root → AppShell.Main.

    Worth recording, since it's the non-obvious part: min-width: 0 / overflow alone do not fix this. They zero a flex item's automatic minimum size, not the min-content contribution travelling up through block ancestors. Measured against this exact layout chain — with overflow set but no containment the page still blew out to 3120px; with containment it sits at the correct 930px.

  • Same host also gained the missing max-width on & pre, which otherwise simply is its explicit width, leaving its own overflow-x nothing to scroll.

  • src/features/csm-cases/pages/CsmCaseDetailPage.tsx — same guard on the read-only Description fallback card (rendered when comments/search fails, so the description never reaches the activity feed). It renders backend HTML through its own host and was exposed to the identical problem.

User stories

As a CS engineer viewing a case, I can read a comment containing a wide pasted table without the page's header actions, Overview column, and timeline toolbar being pushed off-screen.

Release note

Fixed case detail page content overflowing off-screen when a comment contains wide HTML content such as a pasted table.

Documentation

N/A — internal CSM portal UI, no external doc surface affected.

Automation tests

  • Unit tests: csm-cases suite passing (282 passed). Two failures in LinkCaseDialog / CaseActionBar are pre-existing on main and unrelated — confirmed by re-running them on a clean checkout.

  • Verified with the real CaseActivitiesFeed / CsmCaseCommentBubble components mounted in the actual shell layout shape, with a control run to prove the check detects the bug:

    main width "More" button right edge contained
    before 3120px 3179px ❌
    after 930px 989px ✅

    (930px = 1000px viewport − 64px sidebar − borders, i.e. correct layout rather than a collapse.)

Security checks

Test environment

  • pnpm run lint (no new findings), pnpm run test, tsc -b all passing locally.
  • CSS-only change; no API, payload, or sanitisation behaviour altered.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented oversized comments and case descriptions from expanding the page layout.
    • Added horizontal scrolling for wide content, including preformatted text and backend-provided HTML.
    • Improved display of content with explicit widths within the available screen space.

A comment body carrying an explicit pixel width -- what a Word/Excel
paste through the editor's HTML source mode produces, e.g.
<div style="width:2400px"> -- inflated the intrinsic min-content width
of the rich-text host, which propagated up bubble -> feed -> tab ->
page root -> AppShell.Main and dragged the whole case-detail page wider
than the viewport. The header actions, the Overview grid's last column,
and the activity-timeline toolbar all got cut off past the right edge.

The per-tag rules here (& table, & pre, & img) can't cover this: the
width can sit on any element. `contain: inline-size` fixes it
generically by making the host's own width independent of its contents,
and overflowX keeps the wide content reachable by scrolling inside the
comment instead of clipping it.

Note `min-width: 0` / `overflow` alone do NOT solve this -- they zero a
flex item's automatic minimum size, not the min-content contribution
travelling up through block ancestors. Verified against this exact
layout chain: with overflow set but no containment the page still blew
out to 3120px; with containment it stays at the correct 930px.

Also adds the missing max-width to `& pre`, which otherwise just *is*
its explicit width, leaving its own overflow-x nothing to scroll.
…back

The read-only Description card (shown when comments/search fails, so the
description never reaches the activity feed) renders backend HTML through
its own host, so it can be pushed off-screen by an explicit pixel width
exactly like a comment could. Same guard, same reasoning as the comment
bubble.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e6396106-e97d-4aa2-ac28-d43d4bb9677e

📥 Commits

Reviewing files that changed from the base of the PR and between 9dc353e and 2608ca2.

📒 Files selected for processing (1)
  • apps/csm-portal/webapp/src/features/csm-cases/components/CsmCaseCommentBubble.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/csm-portal/webapp/src/features/csm-cases/components/CsmCaseCommentBubble.tsx

📝 Walkthrough

Walkthrough

The change constrains backend-rendered content in case comments and fallback descriptions. Comment containers and preformatted blocks now support horizontal scrolling without expanding the page layout.

Changes

Case content overflow handling

Layer / File(s) Summary
Contain rendered case content
apps/csm-portal/webapp/src/features/csm-cases/components/CsmCaseCommentBubble.tsx, apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
Comment and fallback description containers constrain their inline size and enable horizontal scrolling. Comment <pre> elements remain within the container width.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: rashmika998

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preventing wide comment content from overflowing the case detail page.
Description check ✅ Passed The description explains the problem, goals, implementation, user impact, testing, security checks, documentation impact, and test environment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/csm-portal/webapp/src/features/csm-cases/components/CsmCaseCommentBubble.tsx`:
- Around line 335-356: Update the isSystem rendering branch in
CsmCaseCommentBubble so its HTML content also applies maxWidth, contain:
"inline-size", and overflowX: "auto", matching the regular comment branch.
Ensure system comments with wide backend HTML remain contained and horizontally
scrollable without changing other rendering behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 85b032bf-4b2e-494c-a2ac-b5c26584fe6c

📥 Commits

Reviewing files that changed from the base of the PR and between f69e8eb and 9dc353e.

📒 Files selected for processing (2)
  • apps/csm-portal/webapp/src/features/csm-cases/components/CsmCaseCommentBubble.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx

CsmCaseCommentBubble returns early for authorRole === "system", down a
separate branch that renders backend HTML through its own host. That one
still had only flex:1/min-width:0, so a system entry carrying an explicit
pixel width could push the page off-screen exactly like a regular comment
could -- the original fix only covered the main rich-text host.

Confirmed against the same layout chain, with the system row's own
flex-row shape: 3130px blowout before, correct 936px after.
@rksk
rksk merged commit c7768f3 into wso2-open-operations:main Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants