alpinejs / alpine

A rugged, minimal framework for composing JavaScript behavior in your markup.
https://alpinejs.dev
MIT License
27.92k stars 1.22k forks source link

collapse: remove overflow hidden even if height does not match perfect #4203

Closed gehrisandro closed 4 months ago

gehrisandro commented 4 months ago

Sometimes it happens, that the overflow: hidden style remains on the element after it has expanded.

The reason is, that there is a condition checking that the element height as reached the full height, but sometimes the values do not match perfectly. For example, full is 100.5 but el.getBoundingClientRect().height returns 100.4765625.

This PR changes the condition to allow a difference up to 1px.

To be honest, I am not sure, if the condition is necessary at all.

ekwoka commented 4 months ago

I believe it has to do with the fact that function is called at multiple steps, but not totally sure. I think there are more modern features that can make this actually much easier and simpler, but won't satisfy older targets (Animation API, Animating Grid Rows).

calebporzio commented 4 months ago

Thanks!

gehrisandro commented 4 months ago

Thanks!

Thank you for merging 🚀

bb commented 4 months ago

I encountered the same issue today and can confirm that this PR fixes it. Thank you @gehrisandro! Looking forward to the release. 😊