fix(chat): restore table vertical scroll and cell word wrapping - #248
Conversation
The table scroll container had overflow-y: hidden, which clipped rows below Streamdown's 300px max-height with no way to scroll. This was worsened by PR block#207 (smaller wrapping headers → narrower columns → taller body rows). Long unbreakable strings in td cells also caused horizontal overflow instead of wrapping. - Change overflow-y: hidden → auto on the table scroll container - Add overflow-wrap: break-word to td cells - Update tests to match
|
|
||
| [data-streamdown="table"] td { | ||
| font-size: 0.8125rem; | ||
| overflow-wrap: break-word; |
There was a problem hiding this comment.
🤖 overflow-wrap: break-word does not reduce a table cell’s intrinsic minimum width under automatic table layout, so long unbroken URLs, paths, or identifiers can still expand the table and scroll horizontally instead of wrapping. I reproduced this in Chromium with a 100-character token: the table remained 749px wide inside a 300px container. overflow-wrap: anywhere kept it at 300px and wrapped the token. Could we use anywhere here and, ideally, cover the rendered behavior with a browser/layout test? The current test only verifies that the CSS declaration exists.
Per review feedback: overflow-wrap: break-word does not reduce a table cell's intrinsic minimum width under automatic table layout, so long unbreakable strings still expand the table. Switch to overflow-wrap: anywhere, which participates in min-content sizing. Add a Playwright browser test (table-overflow.spec.ts) that verifies: - Long unbreakable strings wrap within the cell width (no horizontal table expansion) - Tables taller than max-height scroll vertically (overflow-y: auto)
|
🤖 Good catch — updated in 084d619. Changed Also added a Playwright browser layout test (
The browser test uses |
Summary
Tables in chat responses were cutting off text. Two CSS issues combined to cause this:
overflow-y: hiddenon the table scroll container overrode Streamdown's defaultoverflow-y: auto, completely disabling vertical scrolling. Combined with Streamdown's defaultmaxHeight: 300px, any table taller than 300px had its bottom rows clipped with no way to scroll.No
overflow-wrapontdcells — long unbreakable strings (URLs, file paths, code identifiers) caused horizontal overflow instead of wrapping within cells.PR #207 (smaller wrapping headers) made this worse: wrapping headers narrow columns → body text wraps more → rows get taller → more content falls below the 300px cutoff.
Changes
overflow-y: hidden→overflow-y: autoon the table scroll container (globals.css)overflow-wrap: break-wordtotdcells (globals.css)globals.streamdown-table.test.tsto assert the new behaviorRelated issue
none found
Testing