auto-animate icon indicating copy to clipboard operation
auto-animate copied to clipboard

When removing last item, it disappears before it's animated away

Open mtsknn opened this issue 3 years ago • 2 comments

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. 😄

mtsknn avatar May 31 '22 05:05 mtsknn

Thanks for the solid reproductions, thats super helpful. We'll definitely take a look 👍

justin-schroeder avatar May 31 '22 13:05 justin-schroeder

Can this get merged in if there are no problems with it?

LonJonn avatar Jun 13 '22 13:06 LonJonn