taataa / tapspace

Zoomable user interface library for web apps.
https://taataa.github.io/tapspace/
MIT License
58 stars 8 forks source link

prevent bubbling css transition events messing with animations #172

Open axelpale opened 10 months ago

axelpale commented 10 months ago

Animatable:animateOnce places a listener on HTMLElement transitionend event. This listener clears transition property, clears all related listeners and request the component to emit idle as a sign of an ended transformation.

The problem is that CSS transition events bubble. Therefore a transition event closer to leaf of the DOM tree will bubble, regardless of the transition property being set by Tapspace or the host app.

This can cause sudden end of animations set up with animateOnce. A quick animation of a descendant element interrupts any longer animations of its ancestors.

Solution: in animateOnce, handle only events where the target is the space element itself.