Description
Version
2.6.11
Reproduction link
https://codepen.io/turboSheep/pen/OJNQGEG
Steps to reproduce
Click the 'Remove Multiple' or 'Remove First 2' buttons and observe the movement of the items.
What is expected?
The rectangles being removed should fade out on the spot.
What is actually happening?
The rectangles fade out and also move to various locations on the canvas.
Observe that if the items 1 and 2 are to be removed, then the events fired in the following order:
before-leave#1
leave#1
before-leave#2
leave#2
This means that beforeLeave
for the second element is called after leave
is called for the first element. So when beforeLeave
is called for the second element, the first element already has position: absolute
. This means that (while the DOM has not yet rendered the change) the position of the second element has moved to be where the first element used to be, meaning that el.offsetLeft
is now 'incorrect'. The visual effect is that the first two elements both float to the same position.
This can be shown clearly by clicking the 'Remove First 2' button.
Similar behaviour has been documented by issue #9713 but the issue was quickly closed in March 2019 with a workaround posted in Jan 2020.