#View Transition works but "morphing" does not
6 messages · Page 1 of 1 (latest)
Based on the information provided in the extracts, there could be several reasons why the morphing transition is not working in your Astro project.
-
Astro Version: Ensure you're using Astro 3.0 or later, as this version introduced the View Transitions feature.
-
Transition Directive: In Astro 3.0, the
transition:animatevaluemorphhas been renamed toinitial. If you're usingmorph, you should replace it withinitial(source (https://docs.astro.build/en/guides/view-transitions#update-transitionanimate-directives)). -
Nested Components: There's a known issue where nesting Astro components can prevent transition directives from animating. This issue has been discussed in a GitHub thread (https://github.com/withastro/astro/issues/8392). If your component is nested within other components, this could be the cause.
-
Client-side Components: If your component is a client-side component (Astro Island), the
transition:namedirective might not work. In this case, you can use theview-transition-nameCSS property instead (source (https://github.com/withastro/astro/issues/8983)). -
Unique Transition Names: Ensure that the transition names are unique on a page. If two elements on the same page have the same transition name, it could cause issues (source (https://discord.com/channels/830184174198718474/1210143902724661248)).
If none of these solutions work, it might be a good idea to ask for help on the Astro Discord server or open an issue on the Astro GitHub repository.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@tender plume kapa.ai is still learning and improving, please let us know how it did by reacting below
Let me check the knowledge base for you. One moment! :books:
Based on the information provided in the extracts, it seems like you're doing everything correctly with the transition:name directive. However, there are a few potential issues that could be causing the morphing transition not to work:
-
Nested Components: There's a known issue where nesting Astro components can prevent transition directives from animating. This issue has been discussed in a GitHub thread (https://github.com/withastro/astro/issues/8392). If your
Blockcomponent is nested within other components, this could be the cause. -
Client-side Components: If your
Blockcomponent is a client-side component (Astro Island), thetransition:namedirective might not work. In this case, you can use theview-transition-nameCSS property instead (source (https://github.com/withastro/astro/issues/8983)). -
Unique Transition Names: Ensure that the transition names are unique on a page. If two elements on the same page have the same transition name, it could cause issues (source (https://discord.com/channels/830184174198718474/1210143902724661248)).
-
Incorrect Type for
transition:name: Thetransition:nameproperty should be a string. If it's a number, view transitions won't work and there won't be an error message (source (https://github.com/withastro/astro/issues/10150)).
If none of these solutions work, it might be a good idea to ask for help on the Astro Discord server or open an issue on the Astro GitHub repository.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@tender plume kapa.ai is still learning and improving, please let us know how it did by reacting below