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

Nested Transitions NOT Honored #4784

Open
KevinAst opened this issue May 5, 2020 · 9 comments
Open

Nested Transitions NOT Honored #4784

KevinAst opened this issue May 5, 2020 · 9 comments

Comments

@KevinAst
Copy link

KevinAst commented May 5, 2020

I believe I have discovered an issue where Nested Transitions are not operating correctly.

Component:

I have a simple TreeView component (see code here).

  • Each node in the tree is powered through a recursion on itself (via the <svelte:self> element).

  • The expansion state of each node is retained (through a simple ModuleScoped state), so collapsing a parent does not loose the expansion of it's children (when the parent is re-expanded).

  • The expansion/contraction of each node is animated through the standard slide svelte transition

Issue:

The issue I am seeing is when you expand a node that has pre-expanded children, the animated transition only occurs at the top-level. Once the top-level transition has completed, the expanded children pop out instantly. In other words, the nested element transition is NOT honored.

To see this issue:

  1. expand all nodes in the sample (i.e. all children and grandchildren)

  2. collapse the top-level USA node

  3. re-expand the top-level USA node

    NOTICE the direct USA children correctly animate, however the grandchildren pop out instantly, once their parent transition is complete.

In contrast, if you expand/collapse the tree one level at a time, the transition animation is correct.

Am I missing something obvious in my code, or is this in fact an issue?

More Research:

I have found references to this topic in older V2 Issues/PRs, however they are all closed/merged. Is this issue thought to be fixed?

I realize that when dealing with multiple transitions, it can be difficult to generically determine the "right thing to do". This may be a case for driving some compiler directives from the component code itself ... thoughts?

Your help is greatly appreciated!

Thanks so much for such an awesome product, providing reactivity in an extremely simple form!!!

</Kevin>

@KevinAst KevinAst changed the title Nested Translations NOT Honored Nested Transitions NOT Honored May 5, 2020
@dimfeld
Copy link
Contributor

dimfeld commented May 6, 2020

Here's an interesting wrinkle. In Chrome I see the behavior described above. In MacOS Safari 13.1 (Catalina) I see all the nested transitions run, but the positions of elements don't update completely until all the transitions have finished running, so things slide around and a bunch of the elements overlap until they jump to the right place at the end of the transition.

Edit: also I just checked and the changes in #4742 do not appear to fix this.

@KevinAst
Copy link
Author

Thanks for you analyses @dimfeld.

I'm wondering if the author of #4742 (@pushkine) might have any insight on this issue?

@pushkine
Copy link
Contributor

it'll be fixed with #4742
2020-05-11 20-09-58_1

@KevinAst
Copy link
Author

WowZee ... Very Nice ... thanks for all your hard work @pushkine!!

@tiemyshoe
Copy link

Hey broskis, broettes, etc.

Are there any updates on this issue?—seeing as #4742 and #4999 are substantial and therefore not likely to be merged in the short term.

I'd break out the specific logic and PR to fix this hanky panky janky myself, but I'm only a Google expert in HTML. cc @pushkine

Thanks fam! ✌️♥️ & BLM

@stale
Copy link

stale bot commented Jun 26, 2021

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.

@sooxt98
Copy link

sooxt98 commented Feb 28, 2022

wow i finally found the exact issue, due to this i have to use conditional inline style to add scope effect

@Oreilles
Copy link

Oreilles commented Dec 1, 2022

Just facing the same issue.
It's a real shame that @pushkine 's work didn't end up pulled, although I completely understand the maintainers reaction considering the size of the PR. Hopefully someone will find time and motivation to make it work.

@Oreilles
Copy link

Oreilles commented Dec 3, 2022

Here's a REPL to replicate the issue: https://svelte.dev/repl/df7aa3512eef4dfc948212a3141c1556?version=3.53.1

The issue seems to be that the slide transition function calculating the element's height is called before the second level children have been added to the the DOM. For the transitions to work correctly, they should only be called after all the child elements have been added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants