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

Allow nested transition to trigger upon removal #9328

Open
mw76 opened this issue Jan 16, 2019 · 5 comments
Open

Allow nested transition to trigger upon removal #9328

mw76 opened this issue Jan 16, 2019 · 5 comments

Comments

@mw76
Copy link

mw76 commented Jan 16, 2019

Version

2.5.22

Reproduction link

https://jsfiddle.net/wx91uLft/
other: https://jsfiddle.net/ae82rfnv/

Steps to reproduce

  • Show/hide elements with the "Toggle" button.
  • Show/hide elements with the "Toggle Ticked" button. Shows a workaround.

What is expected?

All transitions should be triggered on leave, even for nested child elements.

What is actually happening?

Transition classes don't get applied to nested child elements, when conditions for leaving transitions occur on the same tick.

Workaround: Delaying the parent transitions by one tick fixes the problem.


This has been reported, but got closed due to the sample code did not use appear on the <transition> elements. (See issues #7643 and #9243)

My example is more detailed and also provides a workaround.

@posva
Copy link
Member

posva commented Jan 16, 2019

This is working as expected because when both conditions are set to false on the same tick, only the parent is removed by the v-if, nothing inside is evaluated. That's why the inner transition doesn't trigger, it wasn't removed directly

@posva posva closed this as completed Jan 16, 2019
@mw76
Copy link
Author

mw76 commented Jan 16, 2019

Wow, that's disappointing. 😢
So if we want to have working nested transitions in Vue, this should be considered a feature request?

@posva
Copy link
Member

posva commented Jan 16, 2019

it could be via a new prop on transition I think 🤔 . I haven't checked the feasibility though although it should be possible

@posva posva reopened this Jan 16, 2019
@posva posva changed the title Nested child transitions don't show leave animation Allow nested transition to trigger upon removal Jan 16, 2019
@mw76
Copy link
Author

mw76 commented Jan 16, 2019

Nice! 😊👍

@damtsnkff
Copy link

For future reader, @posva is right, we can achieve that via props.

I made a quick example here for the matter.
I used @before-leave="" to trigger the parent transition (change of state), and @before-enter="" on the parent, to trigger the animation on the child element.

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

No branches or pull requests

4 participants