Skip to content

Commit a74f719

Browse files
waleedlatif1claude
andcommitted
fix(tables): full-column highlight during drag reorder
Replace the thin 2px line drop indicator with a full-column highlight that spans the entire table height, matching Google Sheets behavior. The insertion line is still shown at the drop edge for precision. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 45cbd6a commit a74f719

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,19 @@ export function Table({
318318
return 0
319319
}, [resizingColumn, displayColumns, columnWidths])
320320

321-
const dropIndicatorLeft = useMemo(() => {
322-
if (!dropTargetColumnName) return null
321+
const dropColumnBounds = useMemo(() => {
322+
if (!dropTargetColumnName || !dragColumnName) return null
323323
let left = CHECKBOX_COL_WIDTH
324324
for (const col of displayColumns) {
325-
if (dropSide === 'left' && col.name === dropTargetColumnName) return left
326-
left += columnWidths[col.name] ?? COL_WIDTH
327-
if (dropSide === 'right' && col.name === dropTargetColumnName) return left
325+
const w = columnWidths[col.name] ?? COL_WIDTH
326+
if (col.name === dropTargetColumnName) {
327+
const lineLeft = dropSide === 'left' ? left : left + w
328+
return { left, width: w, lineLeft }
329+
}
330+
left += w
328331
}
329332
return null
330-
}, [dropTargetColumnName, dropSide, displayColumns, columnWidths])
333+
}, [dropTargetColumnName, dragColumnName, dropSide, displayColumns, columnWidths])
331334

332335
const isAllRowsSelected = useMemo(() => {
333336
if (checkedRows.size > 0 && rows.length > 0 && checkedRows.size >= rows.length) {
@@ -1924,11 +1927,17 @@ export function Table({
19241927
style={{ left: resizeIndicatorLeft }}
19251928
/>
19261929
)}
1927-
{dropIndicatorLeft !== null && (
1928-
<div
1929-
className='-translate-x-[1px] pointer-events-none absolute top-0 z-20 h-full w-[2px] bg-[var(--selection)]'
1930-
style={{ left: dropIndicatorLeft }}
1931-
/>
1930+
{dropColumnBounds !== null && (
1931+
<>
1932+
<div
1933+
className='pointer-events-none absolute top-0 z-[15] h-full bg-[rgba(37,99,235,0.06)]'
1934+
style={{ left: dropColumnBounds.left, width: dropColumnBounds.width }}
1935+
/>
1936+
<div
1937+
className='-translate-x-[1px] pointer-events-none absolute top-0 z-20 h-full w-[2px] bg-[var(--selection)]'
1938+
style={{ left: dropColumnBounds.lineLeft }}
1939+
/>
1940+
</>
19321941
)}
19331942
</div>
19341943
{!isLoadingTable && !isLoadingRows && userPermissions.canEdit && (

0 commit comments

Comments
 (0)