File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/hooks/private/useAnimateHeight Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments