vertical-collection
vertical-collection copied to clipboard
Fix occluded-content height inflation from inherited line-height
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-contentelement renders asdisplay: table-row - It contains debug text like "And 5 items before"
- If the page has a
line-heightset (e.g., from Tailwind or global styles), this text creates a line box - The actual rendered height (
getBoundingClientRect().height) becomes larger than the inlinestyle="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
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: 0is 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