Skip to content

Commit 81b8847

Browse files
committed
fix(tables): preserve reference preview scrolling and clipping
1 parent 80afd8d commit 81b8847

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/reference-row-preview.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,21 @@ describe('ReferenceRowPreview', () => {
141141
const subtable = container.querySelector('[role="table"]')
142142
expect(subtable?.className).toContain('w-full')
143143
expect(subtable?.className).toContain('h-full')
144+
expect(subtable?.className).toContain('cursor-default')
145+
expect(subtable?.className).toContain('select-none')
144146
expect(subtable?.className).toContain('grid-rows-2')
145147
expect(subtable?.querySelectorAll('[role="row"]')).toHaveLength(2)
146148
expect(subtable?.querySelectorAll('[role="columnheader"]')).toHaveLength(2)
147149
expect(subtable?.querySelectorAll('[role="cell"]')).toHaveLength(2)
150+
const dataValueWrappers = subtable?.querySelectorAll('[role="cell"] > div') ?? []
151+
expect(
152+
Array.from(dataValueWrappers).every(
153+
(node) =>
154+
node.classList.contains('w-full') &&
155+
node.classList.contains('min-w-0') &&
156+
node.classList.contains('overflow-clip')
157+
)
158+
).toBe(true)
148159
const subtableViewport = container.querySelector('.overscroll-x-contain')
149160
expect(subtableViewport?.className).toContain('overflow-x-auto')
150161
expect(subtableViewport?.className).toContain('overflow-y-hidden')

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/reference-row-preview.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ export const ReferenceRowPreview = memo(function ReferenceRowPreview({
114114
)
115115
} else {
116116
content = (
117-
<div role='table' className='grid h-full w-full min-w-max grid-rows-2 text-small'>
117+
<div
118+
role='table'
119+
className='grid h-full w-full min-w-max cursor-default select-none grid-rows-2 text-small'
120+
>
118121
<div role='row' className='flex min-w-max'>
119122
{columns.map((column) => (
120123
<div
@@ -140,7 +143,7 @@ export const ReferenceRowPreview = memo(function ReferenceRowPreview({
140143
key={column.key}
141144
className='flex w-40 min-w-40 max-w-60 items-center border-[var(--border)] border-r px-2 text-[var(--text-primary)]'
142145
>
143-
<div className='max-w-56 overflow-hidden text-ellipsis whitespace-nowrap'>
146+
<div className='w-full min-w-0 max-w-56 overflow-clip text-ellipsis whitespace-nowrap'>
144147
<CellContent
145148
value={row.data[column.key]}
146149
column={column}

0 commit comments

Comments
 (0)