Skip to content

fix(render): align scrollToRowPosition from the row's actual offsetTop - #4930

Draft
lukecotter wants to merge 1 commit into
tabulator-tables:masterfrom
lukecotter:fix/render-scroll-to-row-position
Draft

fix(render): align scrollToRowPosition from the row's actual offsetTop#4930
lukecotter wants to merge 1 commit into
tabulator-tables:masterfrom
lukecotter:fix/render-scroll-to-row-position

Conversation

@lukecotter

Copy link
Copy Markdown
Contributor

Problem

scrollToRowPosition computed the target offset from the row-height estimate rather
than the row's actual position, so top / center / bottom alignment drifted by the
accumulated estimate error on variable-height rows.

Fix

Align from the row's actual offsetTop. Touches rendering/Renderer.js only.
Alignment now lands within 6px.

Test

test/e2e/scroll-to-row-position.spec.ts.

Performance

Neutral. 500k rows, K=5, medians:

Metric Before After
initial render (ms) 97.6 102.1
initial render, variable heights (ms) 105.6 101.4
fling churn, uniform 14205 14205
fling churn, variable 3935 3935

scrollToRowPosition's center/bottom math derived the offset from the current
scrollTop, assuming scrollToRow had placed the target at the top of the
window. For rows that cannot sit at the top after the fill (e.g. near the
end of the list) this misaligned them — measured ~12px off for center.
Compute the alignment from the row's actual offsetTop instead, and sync
vDomScrollPosTop/Bottom afterwards so the next user scroll does not diff
against a stale tracker and jump (guarded for the basic renderer).

Adds a Playwright regression test asserting a near-bottom row lands within
6px of top/center/bottom.
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.

1 participant