auto-animate
auto-animate copied to clipboard
When removing last item, it disappears before it's animated away
Repro:
- Vanilla JS
- React
- Vue, not a problem for some reason! 😲 No idea why, I'm not very familiar with Vue
Adding an else branch here might fix the issue: https://github.com/formkit/auto-animate/blob/1.0.0-beta.1/src/index.ts#L451-L455
if (next && next.parentNode && next.parentNode instanceof Element) {
next.parentNode.insertBefore(el, next)
} else if (prev && prev.parentNode) {
prev.parentNode.appendChild(el)
+} else {
+ el[TGT].appendChild(el)
}
But I don't know if the change would break something else. 😄
Thanks for the solid reproductions, thats super helpful. We'll definitely take a look 👍
Can this get merged in if there are no problems with it?