-
Notifications
You must be signed in to change notification settings - Fork 4
Eliminate visible layout shift after column/width change (Masonry + Grid) #358
Description
Problem
After a column count change (resize), estimateUnmountedHeight() systematically overestimates unmounted card heights. When the user scrolls to these cards, the mount → remeasure → scroll compensation cycle causes a visible content shift ("reposition").
Root cause: estimateUnmountedHeight() in virtual-scroll.ts splits card height into scalableHeight (covers — scales with width) and fixedHeight (text, properties, header — treated as constant). But fixedHeight IS width-dependent: wider cards → less text wrapping → shorter actual height. The "fixed" portion isn't fixed.
Measured drift: -72 to -137px per card after column increase (e.g., 2→5 cols). Scroll compensations up to -453px observed.
Affects both views: Grid and Masonry share estimateUnmountedHeight(). Masonry currently animates the jump to soften it; Grid has no mitigation yet.
🤖 Generated with Claude Code