Skip to content

Reduce visible layout shift after column/width change #358

Description

@churnish

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions