Skip to content

fix: prevent sticky pinned column overlap#6386

Merged
KevinVandy merged 2 commits into
TanStack:betafrom
gerasidev:fix/sticky-pinned-column-overlap
Jul 6, 2026
Merged

fix: prevent sticky pinned column overlap#6386
KevinVandy merged 2 commits into
TanStack:betafrom
gerasidev:fix/sticky-pinned-column-overlap

Conversation

@gerasidev

@gerasidev gerasidev commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Changes

Closes #5392.

This fixes the React column-pinning-sticky example so resized pinned columns do not overlap when horizontally scrolling.

The example calculates sticky offsets from TanStack Table column sizes, but browser auto table layout could let rendered cell widths diverge from those calculated sizes after resizing. This change makes the rendered table cells respect the explicit column widths by using fixed table layout, border-box sizing, and clipped overflowing content.

Changes made:

  • Add table-layout: fixed to the example table.
  • Add box-sizing: border-box to header and body cells.
  • Hide overflowing header and body cell content.
  • Add ellipsis behavior for nowrap text.

Checklist

  • I have tested this code locally with pnpm test:pr.

Testing

  • git diff --check
  • npm run build from examples/react/column-pinning-sticky

Manual visual testing:

  • Pinned multiple columns left and right.
  • Resized a pinned column wider.
  • Scrolled horizontally.
  • Confirmed pinned columns remain aligned and do not overlap.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the pinned-columns table rendering by enforcing a fixed table layout.
    • Constrained header and body cell content using consistent box sizing and overflow clipping.
    • Enhanced the single-line “no-wrap” styling to truncate overflowing text with an ellipsis instead of letting it spill.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

CSS updates across the column-pinning-sticky examples add fixed table layout, hidden overflow on header and body cells, and ellipsis truncation for nowrap text to keep pinned columns from overlapping while scrolling.

Changes

Sticky Column Overflow Fix

Layer / File(s) Summary
Fixed table layout and cell clipping
examples/react/column-pinning-sticky/src/index.css, examples/angular/column-pinning-sticky/src/styles.css, examples/lit/column-pinning-sticky/src/main.ts, examples/preact/column-pinning-sticky/src/index.css, examples/solid/column-pinning-sticky/src/index.css, examples/svelte/column-pinning-sticky/src/index.css, examples/vue/column-pinning-sticky/src/index.css
Adds table-layout: fixed and constrains th/td with box-sizing: border-box and overflow: hidden across the framework examples.
Ellipsis truncation for nowrap text
examples/react/column-pinning-sticky/src/index.css, examples/angular/column-pinning-sticky/src/styles.css, examples/lit/column-pinning-sticky/src/main.ts, examples/preact/column-pinning-sticky/src/index.css, examples/solid/column-pinning-sticky/src/index.css, examples/svelte/column-pinning-sticky/src/index.css, examples/vue/column-pinning-sticky/src/index.css
Extends .nowrap with overflow: hidden and text-overflow: ellipsis while preserving white-space: nowrap.

Estimated code review effort: 2 (Simple) | ~10 minutes

Related issues: Resolves resized sticky columns overlapping when scrolling horizontally in the Column Pinning Sticky example (#5392).

Suggested labels: examples, css, bugfix

Suggested reviewers: KevinVandy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing sticky pinned column overlap.
Linked Issues check ✅ Passed The CSS changes address the reported overlap after resizing and scrolling in the column-pinning-sticky examples.
Out of Scope Changes check ✅ Passed The cross-framework CSS updates are consistent with the issue fix and the stated intent to apply it broadly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 1697331

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 2m 9s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 22s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-06 21:54:05 UTC

@KevinVandy KevinVandy merged commit 0de6678 into TanStack:beta Jul 6, 2026
6 of 7 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/angular/column-pinning-sticky/src/styles.css`:
- Around line 23-33: The global th styling currently clips both axes, which can
hide the pin controls rendered by the header template. Update the th rule used
by the sticky column-pinning example so the clipping only applies horizontally,
keeping the fixed height behavior while preserving the .pin-actions controls
inside the pinnable header cells. Use the th selector in the styles for the
Angular column-pinning-sticky example as the place to make this adjustment.

In `@examples/lit/column-pinning-sticky/src/main.ts`:
- Around line 352-365: The `th` styles in the sticky column example are clipping
the pin-action controls because `overflow: hidden` is applied to the whole
header cell, including the `th` template that renders the header text,
pin-actions row, and resizer. Update the styling so the horizontal sticky
overlap is handled without clipping vertical content—keep the clip scoped to the
horizontal axis or another wrapper used by the sticky behavior, and avoid
applying full overflow clipping to the `th` itself. Use the existing `th` and
`.pin-actions` markup in the same file to verify the buttons remain visible and
clickable.

In `@examples/preact/column-pinning-sticky/src/index.css`:
- Around line 23-33: The header cell styling in the `th` rule is clipping the
pin controls and resizer because the fixed 30px height and overflow rules apply
to the whole header, including `.nowrap`, `.pin-actions`, and `.resizer`. Update
the header layout in `index.css` so the clipping/ellipsis behavior is handled by
`.nowrap` instead of `th`, or allow the `th` height to grow, while keeping the
header controls visible and accessible.

In `@examples/solid/column-pinning-sticky/src/index.css`:
- Around line 22-32: The table header styling in th is clipping the .pin-actions
controls because the fixed 30px height and overflow hidden prevent the header
from expanding. Update the th rules in index.css so the header can show both the
label and pin/unpin controls, either by removing the fixed height or changing
overflow to only clip horizontally while keeping the vertical content visible.

In `@examples/svelte/column-pinning-sticky/src/index.css`:
- Around line 22-32: The th styling is clipping the pin-action row because
overflow: hidden hides vertical content under the fixed 30px header height.
Update the th rule in the column-pinning-sticky example so only horizontal
overflow is hidden (overflow-x) while preserving vertical visibility, and keep
the rest of the header styling unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 61160862-3ac3-4d80-9f90-6ab486475d49

📥 Commits

Reviewing files that changed from the base of the PR and between 46de1f9 and 1697331.

📒 Files selected for processing (6)
  • examples/angular/column-pinning-sticky/src/styles.css
  • examples/lit/column-pinning-sticky/src/main.ts
  • examples/preact/column-pinning-sticky/src/index.css
  • examples/solid/column-pinning-sticky/src/index.css
  • examples/svelte/column-pinning-sticky/src/index.css
  • examples/vue/column-pinning-sticky/src/index.css

Comment on lines 23 to 33
th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== Files ==\n'
git ls-files 'examples/angular/column-pinning-sticky/*' 'examples/lit/column-pinning-sticky/*' | sort

printf '\n== Angular outline ==\n'
ast-grep outline examples/angular/column-pinning-sticky/src --match '' --view expanded 2>/dev/null || true

printf '\n== Lit outline ==\n'
ast-grep outline examples/lit/column-pinning-sticky/src --match '' --view expanded 2>/dev/null || true

printf '\n== Search for pin buttons / header template ==\n'
rg -n "pin|unpin|button|th|header" examples/angular/column-pinning-sticky examples/lit/column-pinning-sticky

printf '\n== Angular relevant files ==\n'
for f in \
  examples/angular/column-pinning-sticky/src/main.ts \
  examples/angular/column-pinning-sticky/src/styles.css \
  examples/lit/column-pinning-sticky/src/main.ts
do
  if [ -f "$f" ]; then
    echo "--- $f ($(wc -l < "$f") lines) ---"
    sed -n '1,260p' "$f"
  fi
done

Repository: TanStack/table

Length of output: 33356


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== Files ==\n'
git ls-files 'examples/angular/column-pinning-sticky/*' 'examples/lit/column-pinning-sticky/*' | sort

printf '\n== Search for pin buttons / header template ==\n'
rg -n "pin|unpin|button|th|header" examples/angular/column-pinning-sticky examples/lit/column-pinning-sticky

printf '\n== Angular relevant files ==\n'
for f in \
  examples/angular/column-pinning-sticky/src/main.ts \
  examples/angular/column-pinning-sticky/src/styles.css \
  examples/lit/column-pinning-sticky/src/main.ts
do
  if [ -f "$f" ]; then
    echo "--- $f ($(wc -l < "$f") lines) ---"
    sed -n '1,260p' "$f"
  fi
done

Repository: TanStack/table

Length of output: 32380


🏁 Script executed:

#!/bin/bash
set -euo pipefail
git ls-files 'examples/angular/column-pinning-sticky/**' 'examples/lit/column-pinning-sticky/**' | sort

Repository: TanStack/table

Length of output: 1203


Keep th clipping horizontal only examples/angular/column-pinning-sticky/src/app/app.html renders .pin-actions inside each pinnable header cell, so overflow: hidden on the fixed-30px th can clip the pin buttons. overflow-x: hidden preserves the intended horizontal crop without hiding the controls.

Proposed fix
 th {
   background-color: lightgray;
   border-bottom: 1px solid lightgray;
   box-sizing: border-box;
   font-weight: bold;
   height: 30px;
-  overflow: hidden;
+  overflow-x: hidden;
   padding: 2px 4px;
   position: relative;
   text-align: center;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}
th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow-x: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/angular/column-pinning-sticky/src/styles.css` around lines 23 - 33,
The global th styling currently clips both axes, which can hide the pin controls
rendered by the header template. Update the th rule used by the sticky
column-pinning example so the clipping only applies horizontally, keeping the
fixed height behavior while preserving the .pin-actions controls inside the
pinnable header cells. Use the th selector in the styles for the Angular
column-pinning-sticky example as the place to make this adjustment.

Comment on lines +352 to 365
table-layout: fixed;
}

th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

overflow: hidden on th clips the pin-action buttons — confirmed by the markup in this same file.

The th template (Lines 240-299) renders, inside a single th with fixed height: 30px:

<div class="nowrap">...</div>
${pin-actions button row}
<div class="resizer">...</div>

.pin-actions (flex, with gap/padding) plus the header text row will exceed the 30px height whenever a column's pin buttons are shown. Now that overflow: hidden is added to th, that overflow is clipped — and clipped content outside an overflow: hidden box is not rendered or hit-testable, so pin/unpin buttons become invisible and unclickable for any column with visible pin actions.

The reported bug (sticky column overlap) is a horizontal-axis mismatch only; scope the clip accordingly to avoid the regression:

🛡️ Proposed fix
         th {
           background-color: lightgray;
           border-bottom: 1px solid lightgray;
           box-sizing: border-box;
           font-weight: bold;
           height: 30px;
-          overflow: hidden;
+          overflow-x: hidden;
           padding: 2px 4px;
           position: relative;
           text-align: center;
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/lit/column-pinning-sticky/src/main.ts` around lines 352 - 365, The
`th` styles in the sticky column example are clipping the pin-action controls
because `overflow: hidden` is applied to the whole header cell, including the
`th` template that renders the header text, pin-actions row, and resizer. Update
the styling so the horizontal sticky overlap is handled without clipping
vertical content—keep the clip scoped to the horizontal axis or another wrapper
used by the sticky behavior, and avoid applying full overflow clipping to the
`th` itself. Use the existing `th` and `.pin-actions` markup in the same file to
verify the buttons remain visible and clickable.

Comment on lines 23 to 33
th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n "pin-actions|resizer" examples/preact/column-pinning-sticky/src/main.tsx -A3 -B3

Repository: TanStack/table

Length of output: 982


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== main.tsx relevant section =="
sed -n '170,255p' examples/preact/column-pinning-sticky/src/main.tsx

echo
echo "== index.css relevant section =="
sed -n '1,120p' examples/preact/column-pinning-sticky/src/index.css

Repository: TanStack/table

Length of output: 5285


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "\.(pin-actions|pin-button|resizer|nowrap)\b|pin-actions|pin-button|resizer|nowrap" examples/preact/column-pinning-sticky/src/index.css examples/preact/column-pinning-sticky/src/main.tsx -A4 -B4

Repository: TanStack/table

Length of output: 9873


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Preact markup =="
sed -n '185,250p' examples/preact/column-pinning-sticky/src/main.tsx

echo
echo "== Lit markup =="
fd -a 'main.ts' examples/lit/column-pinning-sticky/src

Repository: TanStack/table

Length of output: 3052


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba examples/preact/column-pinning-sticky/src/main.tsx | sed -n '185,250p'
echo
nl -ba examples/preact/column-pinning-sticky/src/index.css | sed -n '1,80p'

Repository: TanStack/table

Length of output: 192


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate column-pinning-sticky examples =="
fd -a 'index.css' examples | rg 'column-pinning-sticky'
echo
fd -a 'main.tsx' examples | rg 'column-pinning-sticky'
echo
echo "== search for overflow settings and header controls in similar demos =="
rg -n "overflow-x: hidden|overflow: hidden|pin-actions|resizer|nowrap" examples -g 'index.css' -g 'main.tsx' -g '*.ts' -g '*.tsx'

Repository: TanStack/table

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Lit sticky header markup =="
sed -n '235,310p' examples/lit/column-pinning-sticky/src/main.ts

echo
echo "== Lit sticky relevant CSS =="
sed -n '350,515p' examples/lit/column-pinning-sticky/src/main.ts

Repository: TanStack/table

Length of output: 7625


Keep the header controls out of the clipped th. In examples/preact/column-pinning-sticky/src/index.css, the 30px th still wraps .nowrap, .pin-actions, and .resizer as stacked siblings, so overflow-x: hidden leaves the vertical clipping intact and can hide the pin buttons/resizer. Move the ellipsis clipping to .nowrap, or let the header height expand.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/preact/column-pinning-sticky/src/index.css` around lines 23 - 33,
The header cell styling in the `th` rule is clipping the pin controls and
resizer because the fixed 30px height and overflow rules apply to the whole
header, including `.nowrap`, `.pin-actions`, and `.resizer`. Update the header
layout in `index.css` so the clipping/ellipsis behavior is handled by `.nowrap`
instead of `th`, or allow the `th` height to grow, while keeping the header
controls visible and accessible.

Comment on lines 22 to 32
th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n "pin-actions|resizer" examples/solid/column-pinning-sticky/src/App.tsx -A3 -B3

Repository: TanStack/table

Length of output: 982


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## App.tsx excerpt\n'
sed -n '160,235p' examples/solid/column-pinning-sticky/src/App.tsx

printf '\n## index.css excerpt\n'
sed -n '1,80p' examples/solid/column-pinning-sticky/src/index.css

Repository: TanStack/table

Length of output: 4618


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "^(\.pin-actions|\.nowrap|\.resizer|th \{|td \{|\.table-container|\.button-row)" examples/solid/column-pinning-sticky/src/index.css -A8 -B3

printf '\n## Tail of CSS\n'
sed -n '80,180p' examples/solid/column-pinning-sticky/src/index.css

Repository: TanStack/table

Length of output: 3233


Keep the header controls visible

th contains both the header label and the .pin-actions row, so the fixed height: 30px plus overflow: hidden clips the pin/unpin buttons. Switch to horizontal-only clipping or let the header grow to fit the controls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/solid/column-pinning-sticky/src/index.css` around lines 22 - 32, The
table header styling in th is clipping the .pin-actions controls because the
fixed 30px height and overflow hidden prevent the header from expanding. Update
the th rules in index.css so the header can show both the label and pin/unpin
controls, either by removing the fixed height or changing overflow to only clip
horizontally while keeping the vertical content visible.

Comment on lines 22 to 32
th {
background-color: lightgray;
border-bottom: 1px solid lightgray;
box-sizing: border-box;
font-weight: bold;
height: 30px;
overflow: hidden;
padding: 2px 4px;
position: relative;
text-align: center;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n "pin-actions|resizer" examples/svelte/column-pinning-sticky/src/App.svelte -A3 -B3

Repository: TanStack/table

Length of output: 903


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== App.svelte header area ==="
sed -n '160,235p' examples/svelte/column-pinning-sticky/src/App.svelte

echo
echo "=== index.css relevant rules ==="
sed -n '1,120p' examples/svelte/column-pinning-sticky/src/index.css

Repository: TanStack/table

Length of output: 5046


Avoid clipping the pin actions overflow: hidden on th will hide the pin-action row under the fixed 30px header height. Change it to overflow-x: hidden.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/svelte/column-pinning-sticky/src/index.css` around lines 22 - 32,
The th styling is clipping the pin-action row because overflow: hidden hides
vertical content under the fixed 30px header height. Update the th rule in the
column-pinning-sticky example so only horizontal overflow is hidden (overflow-x)
while preserving vertical visibility, and keep the rest of the header styling
unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resized sticky columns overlap when scrolling horizontally

2 participants