Skip to content

Commit 3c9ed9b

Browse files
fix(Dialog): fix broken animation with header tags (#2465)
1 parent 94ad2d0 commit 3c9ed9b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/hooks/private/useAnimateHeight/useAnimateHeight.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export function useAnimateHeight({
6666
return;
6767
}
6868

69+
// Skip animation if height hasn't changed (avoids heading margin collapsing issues)
70+
if (previousHeight.current && contentHeight === previousHeight.current) {
71+
return;
72+
}
73+
6974
// Avoid "ResizeObserver loop completed with undelivered notifications" error
7075
resizeInfo.observer?.unobserve(node);
7176

@@ -109,8 +114,8 @@ function calculateNodeHeight(node: HTMLElement) {
109114
return node.clientHeight;
110115
}
111116

112-
const paddingTop = parseFloat(computedStyle.getPropertyValue('padding-top'));
113-
const paddingBottom = parseFloat(computedStyle.getPropertyValue('padding-bottom'));
117+
const paddingTop = parseInt(computedStyle.getPropertyValue('padding-top'), 10);
118+
const paddingBottom = parseInt(computedStyle.getPropertyValue('padding-bottom'), 10);
114119

115120
return node.clientHeight - paddingTop - paddingBottom;
116121
}

0 commit comments

Comments
 (0)