Skip to content

Commit 85706f8

Browse files
committed
feat: use max of top and bottom margin for item container height (#404)
1 parent 58e3ed9 commit 85706f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/controlledEnvironment/layoutUtils.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ export const computeItemHeight = (treeId: string) => {
77
if (firstItem) {
88
const style = getComputedStyle(firstItem);
99
// top margin flows into the bottom margin of the previous item, so ignore it
10-
return firstItem.offsetHeight + parseFloat(style.marginBottom);
10+
return (
11+
firstItem.offsetHeight +
12+
Math.max(parseFloat(style.marginTop), parseFloat(style.marginBottom))
13+
);
1114
}
1215
return 5;
1316
};

0 commit comments

Comments
 (0)