Skip to content

fix: prevent incident table horizontal overflow from long summaries#6084

Open
tysoncung wants to merge 1 commit intokeephq:mainfrom
tysoncung:fix/incident-table-summary-overflow
Open

fix: prevent incident table horizontal overflow from long summaries#6084
tysoncung wants to merge 1 commit intokeephq:mainfrom
tysoncung:fix/incident-table-summary-overflow

Conversation

@tysoncung
Copy link

What

Fixes #6083

The incidents table stretches horizontally beyond the viewport when an incident has a long AI-generated summary.

Root Cause

Two issues combine:

  1. FormattedContent renders HTML via dangerouslySetInnerHTML, producing block-level elements (<p>, <ul>, etc.) that create their own block formatting context. line-clamp on the outer container cannot penetrate into these child block elements, so the text is never clamped.

  2. The table cell has no max-width or overflow constraint, so it grows unbounded with the unclamped content, stretching the entire table.

Changes

1. Add plain prop to FormattedContent

New optional plain prop strips HTML tags and renders as plain inline text, allowing line-clamp to work correctly.

keep-ui/shared/ui/FormattedContent/FormattedContent.tsx:

  • Added stripHtmlTags() utility
  • Added plain prop to FormattedContentProps
  • When plain is true, strips HTML and renders as a plain text div

2. Constrain the Incident column cell

keep-ui/features/incidents/incident-list/ui/incidents-table.tsx:

  • Added max-w-md overflow-hidden to the cell container
  • Set plain prop on FormattedContent so line-clamp-3 works
  • Added text-sm text-gray-500 for visual hierarchy between title and summary

The Incident column in the incidents table stretches beyond the viewport
when an incident has a long AI-generated summary. This happens because:

1. FormattedContent renders HTML via dangerouslySetInnerHTML, producing
   block-level elements (p, ul, etc.) that create their own block
   formatting context. CSS line-clamp on the outer container cannot
   penetrate into these child blocks, so text is never clamped.

2. The table cell has no overflow or max-width constraint, so it grows
   with the unclamped content.

Fix:
- Add a 'plain' prop to FormattedContent that strips HTML tags and
  renders as plain text, allowing line-clamp to work correctly
- Add max-w-md and overflow-hidden to the Incident column cell
- Use the plain prop in the incidents table for summary display

Fixes keephq#6083
@vercel
Copy link

vercel bot commented Mar 9, 2026

@tysoncung is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 9, 2026
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dosubot dosubot bot added Bug Something isn't working UI User interface related issues labels Mar 9, 2026
@Aladex
Copy link
Contributor

Aladex commented Mar 9, 2026

I opened #6083 and went through several iterations trying to fix this. A few notes on this PR:

max-w-md on the div won't work well. We tried max-w-sm first — it clips text mid-character on narrower viewports because the fixed max-width doesn't adapt to the available table space. max-w-md will have the same problem, just at a slightly larger breakpoint.

The fix needs to be on the <td>, not the inner div. With table-layout: auto (default), the table cell grows with its content regardless of the inner div's max-width. The constraint needs to be at the cell level. We found that adding overflow-hidden via the column's meta.tdClassName is what actually prevents the table from stretching:

meta: {
  tdClassName: "overflow-hidden",
},

We're still testing the right combination on our deployment — will open a proper PR once we've verified it works end-to-end.

@shahargl
Copy link
Member

shahargl commented Mar 9, 2026

@Aladex @tysoncung can you sign the CLA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files. UI User interface related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Incident table stretches horizontally when summary is long

4 participants