🐞 fix: Keep max-height at pixel value after open so close animates
This commit is contained in:
@@ -50,17 +50,11 @@ const animateOpen = (bioWrap) => {
|
|||||||
setMaxHeight(bioWrap, `${target}px`);
|
setMaxHeight(bioWrap, `${target}px`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// After the transition completes, set max-height back to 'none' so
|
// After the transition completes, leave max-height at the measured
|
||||||
// dynamic content (e.g. images loading late) can grow the bio
|
// pixel value. Resetting to 'none' breaks the close animation: the
|
||||||
// without being clipped.
|
// browser treats 'none' as a discrete keyword value and won't
|
||||||
const onEnd = (event) => {
|
// transition from it to a length. The pixel value gives the close
|
||||||
if (event.propertyName !== 'max-height' || event.target !== bioWrap) {
|
// animation a clean from-state to interpolate from.
|
||||||
return;
|
|
||||||
}
|
|
||||||
bioWrap.removeEventListener('transitionend', onEnd);
|
|
||||||
setMaxHeight(bioWrap, 'none');
|
|
||||||
};
|
|
||||||
bioWrap.addEventListener('transitionend', onEnd);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const animateClose = (bioWrap) => {
|
const animateClose = (bioWrap) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user