vertical-collection icon indicating copy to clipboard operation
vertical-collection copied to clipboard

Fix occluded-content height inflation from inherited line-height

Open johanrd opened this issue 1 month ago • 0 comments

Summary

Fixes an issue where occluded-content height could be inflated by inherited line-height when used inside tables, causing visual jumps during scrolling.

Problem

When using VerticalCollection inside a <table>:

  • The occluded-content element renders as display: table-row
  • It contains debug text like "And 5 items before"
  • If the page has a line-height set (e.g., from Tailwind or global styles), this text creates a line box
  • The actual rendered height (getBoundingClientRect().height) becomes larger than the inline style="height: 44px"
  • VerticalCollection measures this inflated height and "corrects" its estimate upward
  • This causes rows to visually jump (e.g., 44px → 96.5px) when they first appear Screenshot 2025-11-28 at 14 16 06

Solution

Add font-size: 0 and line-height: 0 to .occluded-content CSS, ensuring the debug text cannot affect layout height.

Test plan

  • [x] Added test verifying line-height: 0 is set on occluded-content
  • [x] Added test verifying actual height matches style height in tables
  • [x] Verified test fails without fix, passes with fix

Before fix: not ok 1 - occluded-content should have line-height: 0 expected: 0px actual: 20px

After fix: ok 1 - occluded-content should have line-height: 0

johanrd avatar Nov 28 '25 13:11 johanrd