Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit a97a8b6

Browse files
committed
fix: allow markdown tables to scroll horizontally instead of compressing
1 parent 137d3f4 commit a97a8b6

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

webview-ui/src/components/common/MarkdownBlock.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,8 @@ const StyledMarkdown = styled.div`
166166
/* Table styles for remark-gfm */
167167
table {
168168
border-collapse: collapse;
169-
margin: 1em 0;
170169
width: auto;
171170
min-width: 50%;
172-
max-width: 100%;
173-
table-layout: fixed;
174171
}
175172
176173
/* Table wrapper for horizontal scrolling */
@@ -184,8 +181,7 @@ const StyledMarkdown = styled.div`
184181
border: 1px solid var(--vscode-panel-border);
185182
padding: 8px 12px;
186183
text-align: left;
187-
word-wrap: break-word;
188-
overflow-wrap: break-word;
184+
white-space: nowrap;
189185
}
190186
191187
th {

webview-ui/src/components/common/__tests__/MarkdownBlock.spec.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,28 @@ describe("MarkdownBlock", () => {
8888
expect(screen.getByText("Step three")).toBeInTheDocument()
8989
})
9090

91+
it("should render tables inside a scrollable wrapper", async () => {
92+
const markdown = `| Column A | Column B | Column C |
93+
| --- | --- | --- |
94+
| Data 1 | Data 2 | Data 3 |`
95+
96+
const { container } = render(<MarkdownBlock markdown={markdown} />)
97+
98+
await screen.findByText("Column A")
99+
100+
// Table should be wrapped in a .table-wrapper div for horizontal scrolling
101+
const wrapper = container.querySelector(".table-wrapper")
102+
expect(wrapper).toBeInTheDocument()
103+
104+
const table = wrapper?.querySelector("table")
105+
expect(table).toBeInTheDocument()
106+
107+
// Verify table content renders correctly
108+
expect(screen.getByText("Column B")).toBeInTheDocument()
109+
expect(screen.getByText("Data 1")).toBeInTheDocument()
110+
expect(screen.getByText("Data 3")).toBeInTheDocument()
111+
})
112+
91113
it("should render nested lists with proper hierarchy", async () => {
92114
const markdown = `Complex list:
93115
1. First level ordered

0 commit comments

Comments
 (0)