Skip to content

fix: removed table rows keep their layout while animating out (#7) - #260

Merged
justin-schroeder merged 2 commits into
masterfrom
fix/7-table-row-removal
Nov 22, 2026
Merged

justin-schroeder merged 2 commits into
masterfrom
fix/7-table-row-removal

Conversation

@justin-schroeder

Copy link
Copy Markdown
Member

Fixes #7.

A leaving element is set to position: absolute so it can fade out in place. For a <tr> that drops table layout: cells collapse to their content (195px → 46px in the test), and in Firefox the row also jumped 28px down. The animated-out row looked like it "floated outside the table".

For table rows only (display: table-row):

  • render the leaving row as its own display: table; table-layout: fixed with each cell pinned to its measured width (box-sizing: border-box)
  • carry over the table's border-collapse / border-spacing, offsetting the spacing so cells don't shift
  • line the row up on its first cell's original position (browsers disagree on how a row box relates to border-spacing)
  • restore the cells' inline styles on cleanup, so a re-inserted row lays out normally

Other elements are untouched (one extra getComputedStyle per removal to detect rows).

Tests: new table-row-layout.spec.ts covers separate + 4px spacing, collapse, and separate + 10px 2px spacing. In every case, every cell of the leaving row stays within ±2px (±4px width) of its original box, and cell styles are cleared after. 9/9 pass on Chromium, Firefox and WebKit; the test fails on master. Full e2e: 115 passed, 8 skipped.

An absolutely positioned <tr> loses table layout, so its cells collapsed to
their content and (in Firefox) the row jumped down. The leaving row now
renders as its own fixed-layout table with each cell pinned to its measured
width, border-spacing compensated, and is lined up on its first cell. Cell
styles are restored on cleanup.
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
auto-animate Ready Ready Preview Nov 22, 2026 11:18pm UTC

Request Review

…lugins alone, restore only pinned cell styles, anchor on pre-removal position
@justin-schroeder

Copy link
Copy Markdown
Member Author

Independent review found 4 edge cases, all fixed with regression tests that fail on the previous commit:

  • transformed tables: cell widths now use layout sizes (offsetWidth) and the correction is scaled
  • plugins: row handling only runs on the default path; plugin styleReset positioning is untouched
  • cleanup: restores only the width/box-sizing it set, and only if still unchanged, so app style changes survive
  • thead rows: anchor computed from the pre-removal row coordinates

table-row-layout: 21/21 across Chromium/Firefox/WebKit. Full e2e green.

@justin-schroeder
justin-schroeder merged commit a938ae7 into master Nov 22, 2026
3 checks passed
@justin-schroeder
justin-schroeder deleted the fix/7-table-row-removal branch November 22, 2026 23:22

This branch was successfully deployed

1 active deployment
Preview — bc794ea9 Deployed Nov 22, 2026 by vercel[bot]
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.

Applying AutoAnimate to table rows destroys row display format

1 participant