Skip to content

Eliminate visible layout shift after column/width change (Masonry + Grid) #358

@churnish

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

Metadata

Metadata

Assignees

Labels

Feature requestRequest for new feature or improvementHelp wantedWould gladly accept PR for this🏠 BasesAffects Obsidian Bases views🟠 High priorityImportant issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions