-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Animation with delay can lead to outdated css rules #2871
Comments
Fix issue sveltejs#2871
Released 3.4.4 with the partial fix, but will leave this open until we've squashed the starting position bug |
Thank you for merging! I will have a look on it. |
It took me a while to find a possible solution. The problem with the wrong starting position was a result of transition + animation. Please review pull-request #2904. Thank you! |
Cleaned up the commit history, sorry for the clutter. 😁 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed as it was previously marked as stale and saw no subsequent activity. |
I played around with the todo list from the animation tutorial (https://svelte.dev/tutorial/animate) and adapted it like so:
The result seems to work fine: https://svelte.dev/repl/fbcd977718ea4d70abde8adee151515d?version=3.4.2
Then I continued playing around and replaced the delay with an unreasonable huge number (3s). The behaviour seems very odd when you interact with the todo list before the animation actually starts, leaving the todo items on akward positions somewhere in between, where they should not be: https://svelte.dev/repl/31c4535d1e2c4a548ec55f6fc739facc?version=3.4.2
To reproduce, check and remove todos before the 3s delay.
After debugging the code I found out what the problem is:
svelte/src/internal/animations.js
Line 65 in 0891495
svelte/src/internal/animations.js
Line 30 in 0891495
...which could be deleted later.
svelte/src/internal/animations.js
Line 37 in 0891495
I also found out, that there is a TODO here, which points out the solution:
svelte/src/internal/animations.js
Line 29 in 0891495
I adapted animation.js accordingly - using animation-delay instead and will create a pull request to solve this issue shortly.
Still the items are on akward positions, but only until the delay expires. Then the items are repositioned automatically.
Note, that according to MDN, this will work only for IE10 or later: https://developer.mozilla.org/en-US/docs/Web/CSS/animation-delay
Thank you for the great work, Svelte is a cool thing! 👍😀
The text was updated successfully, but these errors were encountered: