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

Feasible to clean up removed DOM elements for re-insertion?

Open ollicle opened this issue 3 years ago • 3 comments

Current behaviour appears to presume removed elements will be discarded.

The animation is broken when I re-append a previously removed element. I’m guessing because it is being inserted with the style properties AutoAnimate left on it when it was removed?

A simple demonstration:
https://gregarious-maroon-iguanacolossus.glitch.me

Glitch source: https://glitch.com/edit/#!/gregarious-maroon-iguanacolossus

Is it feasible to remove the applied “exit styles” once the animation is complete (upon removal from the DOM)? This would enable animations in scenarios such as this where interaction is applied as a progressive enhancement.

One work around I am considering is creating a disposable wrapper element that is recreated upon remove/insert.

ollicle avatar Jul 05 '22 01:07 ollicle

This seams reasonable to me. Thanks for the suggestion.

justin-schroeder avatar Jul 26 '22 18:07 justin-schroeder

This is resolved with changes made in https://github.com/formkit/auto-animate/releases/tag/0.8.0

ollicle avatar Sep 10 '23 12:09 ollicle

Ah, that's true actually.

justin-schroeder avatar Sep 10 '23 12:09 justin-schroeder