Skip to content
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

Transition not working when used on elements in #each block #13345

Closed
memestageceo opened this issue Sep 20, 2024 · 2 comments
Closed

Transition not working when used on elements in #each block #13345

memestageceo opened this issue Sep 20, 2024 · 2 comments

Comments

@memestageceo
Copy link

Describe the bug

Transition inside each block doesn't work. The items appear without transition.

{#if count}
	<p transition:fade={{duration: 2000}}>
		what up
	</p>
	{#each new Array(5) as _, index}
		<li transition:fade={{duration: 1000}}>number {index}</li>
	{/each}
{/if}

They do follow duration, but the transition itself doesn't work.

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACn2P0UoDMRBFf2VMBVtY2Cr4sm6FfocRSbMTDGYnSzKxlpB_l2SpffMtc--cuTdZGOswiuEtC1IzikEcl0V0gi9LHeI3OkbRiehT0FUZow524VdJku28-MCQjZqwA-MuBUzwMzysWM9BUbRsPT3UdYcM2idiOMB9ZMW4NcpF3L1Iqr5JpOsyWNIBZyTe7iBXR_KVu2uPqhVJY38rQ-MpMXsCT9pZ_XXIf1dKK9vUOEBuFxq9Eo3OG2vg6kgeF7iVH-r_DjlPKag2w9N-vy_rWcnnT8WQlob1SxPzBpX-BMIzHENQl-3zDlSEjw4sTfhTVnB09t-UxzWF0nzCAHlFx97ZNaOvGUVS7q0pohOzn6yxOImBQ8LyXn4B5sGDNd0BAAA=

Logs

No response

System Info

msedge, chrome

Severity

blocking an upgrade

@JetLua
Copy link

JetLua commented Sep 20, 2024

Maybe you need to add global => <li transition:fade|global={{duration: 1000}}>number {index}</li>.

https://svelte.dev/docs/element-directives#transition-fn

Transitions are local by default (in Svelte 3, they were global by default). Local transitions only play when the block they belong to is created or destroyed, not when parent blocks are created or destroyed.

@Conduitry
Copy link
Member

Yes, this is the intended behavior.

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants