🐞 fix: Keep max-height at pixel value after open so close animates

This commit is contained in:
Keith Solomon
2026-07-25 15:45:14 -05:00
parent 842818ec7e
commit 01072f6788
+5 -11
View File
@@ -50,17 +50,11 @@ const animateOpen = (bioWrap) => {
setMaxHeight(bioWrap, `${target}px`);
});
// After the transition completes, set max-height back to 'none' so
// dynamic content (e.g. images loading late) can grow the bio
// without being clipped.
const onEnd = (event) => {
if (event.propertyName !== 'max-height' || event.target !== bioWrap) {
return;
}
bioWrap.removeEventListener('transitionend', onEnd);
setMaxHeight(bioWrap, 'none');
};
bioWrap.addEventListener('transitionend', onEnd);
// After the transition completes, leave max-height at the measured
// pixel value. Resetting to 'none' breaks the close animation: the
// browser treats 'none' as a discrete keyword value and won't
// transition from it to a length. The pixel value gives the close
// animation a clean from-state to interpolate from.
};
const animateClose = (bioWrap) => {