Skip to content

Reordered items (v-for) lose all their ongoing transitions when move up (but don't when they move down). #13188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
orimay opened this issue Apr 10, 2025 · 5 comments
Labels
has workaround A workaround has been found to avoid the problem ✨ feature request New feature or request

Comments

@orimay
Copy link

orimay commented Apr 10, 2025

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNqNVMlu2zAQ/ZUBL7IBr2h7UZ2iSZFDemiLtDfLB5kayYxpUuDiBYb/vUOKdly4DXqSOAvfm3lPOrL7th1tPbKczSw3onVg0fkWZKmau4I5W7BPhQIQm1YbB0cwWMMJaqM3kFFjVqiQ5lpZB8LhxsJdqOnNs/tskD1ki/7HrqT2ijuhFdiVr2uJvT4cQ5zuDm2jbSk9UvP86jifLgbX6flksaDrAE6Fmo07wkSPDlTTytJhJDtbTeMT4Bm1qdBglbj1tsNamz5IbRFKKcGtUBjQqtFCNeBMqawILC3sVqhgo7cItI7e0juotMpcF6e2Q5es9E71RxF1nGBnbUJ/quGgPXAp+Dq0QC1MWlMYC3aCGNRlRYmwz0DTaWgMEkKEiQVL5HqDpAstuUpIHcK/gWR5g6O0+2+syPNPqEps4XMEIFskCZM3UjaulpIBFoTqNl4wyNd4SGE6caJmL8fUTwaK1An6eIyNcCKJ49VjurujkN5m4yux6WjdQXa6j2JnclVbVhVpmsN00u6jaQCWJV83RntVDbmW2uTdAlL2Vf38phI+TCbkHywtDoUaau9Sk7dohhYlcpfTjhWmOPfGBoCWjOXQnF2bSOYr8o45U72lRfJc+TwNyAb0PZIJatGMXqxW9NHGCwpGorVCovneRu8WLD9fXTByud59jTFnPA7Ocb5Cvv5L/MXuQ6xgPwzSbFtS+ZJzpWnQdenHn99wT++X5EZXPnjijeQzWi194NiVPdDIRPuqLrJ9ij8bEu+Xfdw7JFHSUIFoXEusLxj9gL68Mfor3Xej92mdJ3b6DVTqpjA=

Steps to reproduce

Make a v-for list of items, that have ongoing transitions, then reorder them

What is expected?

When we have a v-for with items that have an ongoing transition, and they reorder, all of the items should maintain their ongoing transitions, regardless of their moving directions

What is actually happening?

When we have a v-for with items that have an ongoing transition, and they reorder, only the items that move down maintain their transitions

System Info

Any additional comments?

This affects all the transitions, no matter how deep they are

@edison1105
Copy link
Member

This seems to be the browser's behavior, see MDN playground

@Justineo
Copy link
Member

Justineo commented Apr 11, 2025

Chrome has recently introduced a new DOM API, moveBefore, as a drop-in replacement for insertBefore that better preserves element state.

We could consider using moveBefore as a progressive enhancement where supported. It helps maintain:

  • Focus
  • Animation and transition states
  • Video playback state
  • ...

@edison1105 edison1105 added the ✨ feature request New feature or request label Apr 11, 2025
@orimay
Copy link
Author

orimay commented Apr 11, 2025

But it also happens on Firefox (which doesn't have moveBefore). Though Chrome is my main concern. Could we have moveBefore instead of insertBefore, if it exists?

@orimay
Copy link
Author

orimay commented Apr 11, 2025

Chrome has recently introduced a new DOM API, moveBefore, as a drop-in replacement for insertBefore that better preserves element state.

We could consider using moveBefore as a progressive enhancement where supported. It helps maintain:

* Focus

* Animation and transition states

* Video playback state

* ...

Awesome, thank you! Here's my solution for the time being

@edison1105 edison1105 added the has workaround A workaround has been found to avoid the problem label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround A workaround has been found to avoid the problem ✨ feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants