fix: prevent incident table horizontal overflow from long summaries#6084
fix: prevent incident table horizontal overflow from long summaries#6084tysoncung wants to merge 1 commit intokeephq:mainfrom
Conversation
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
|
@tysoncung is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
|
|
|
I opened #6083 and went through several iterations trying to fix this. A few notes on this PR:
The fix needs to be on the 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. |
|
@Aladex @tysoncung can you sign the CLA? |
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:
FormattedContentrenders HTML viadangerouslySetInnerHTML, producing block-level elements (<p>,<ul>, etc.) that create their own block formatting context.line-clampon the outer container cannot penetrate into these child block elements, so the text is never clamped.The table cell has no
max-widthor overflow constraint, so it grows unbounded with the unclamped content, stretching the entire table.Changes
1. Add
plainprop toFormattedContentNew optional
plainprop strips HTML tags and renders as plain inline text, allowingline-clampto work correctly.keep-ui/shared/ui/FormattedContent/FormattedContent.tsx:stripHtmlTags()utilityplainprop toFormattedContentPropsplainis true, strips HTML and renders as a plain text div2. Constrain the Incident column cell
keep-ui/features/incidents/incident-list/ui/incidents-table.tsx:max-w-md overflow-hiddento the cell containerplainprop onFormattedContentsoline-clamp-3workstext-sm text-gray-500for visual hierarchy between title and summary