-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
website breaking x-transition bug (update: 1.20.0) #170
Comments
Noticed that @calebporzio has done a release addressing some of this issue. So I'm just doing an update to show my findings on v1.11.0 (https://codepen.io/TomS-/pen/eYNJZOx) Fixed: Still doesn't work:
EDIT: EDIT: |
Update: 1.20.0 (https://codepen.io/TomS-/pen/BaNKmaV) Using |
Hey @TomS- It seems like there are a couple of different issues you're referencing here. Let's just start with interrupting slow transitions breaking things. I've encountered that issue too. What is the best behavior in a case like that? Let the transition finish? Interrupt it? Block interactions during? I'd love help researching how Vue and other packages handle this. I'm pretty busy this week and next so I want to focus on this, but I'll need some help with the legwork of identifying the issue and potential solutions. Thanks in advance! |
@calebporzio I will have some time coming up, I will definitely look into this and see if I can provide any more information. My JavaScript abilities are not the best and I fully believe that someone like @SimoTod would do a much better job, but I'm happy to research into it and identifiy any code that could be causing the issue and a solution. |
hi @TomS- As Caleb suggested, there are 3 possible approaches:
the first option is the one that would look less weird to me but I'm not sure what other frameworks do. The second point (slider broken when you change tab) is because nextThick is emptied before the new slider shows. I'm not sure about the reason since I haven't had a look at the code yet. |
I have done some research into VueJS and how it handles animations. But also libraries like AnimeJS, and it seems like the common way of handling this is similar to jQuery's .stop() (https://api.jquery.com/stop/) which is solution 1. The animation would be immediately interupted and the second one will play. I think number 3 would cause things to not align up with the data that is in the component if an animation happens. I feel like it's important to make sure x-show and the data in x-data matches. I feel like 1 is the only solution to do this. It is easily possible at the moment if a transition is applied to have display: none on an element while the data says it should be active. R.E: nextTick, I applied it here because I assumed it would fire when the data has changed. Flickity requires you to trigger .resize() when the visiblity of the slider has changed. The only reason it works without in my demo is because I've set an absolute height so it doesn't need to do the recalculation on visibility change. |
It should fire when data changes, but it seems to fire too early. Not sure if it's due to the transition or other pieces of code (debounce? Timeout? NextTick emptied before the element is refreshed). I'll try to have a look during the weekend. |
@SimoTod Regarding NextTick, there is an example that doesn't have a transition but the next tick works as expected (or what I believe is as expected) I've adapted it so it makes more sense (https://codepen.io/TomS-/pen/dyoYmvK) so it first loads empty purely because there is nothing checking if the images have loaded or no placeholder there. But if you click on the tab you will see that resize() will cause it to calculate the height correctly. As soon as a transition is applied this functionality get's broken. |
I put a couple of console logs in the source code and I can confirm that nextTick runs after the data context has been updated as expected but, unfortunately, before the transition completes. When nextTick runs, the carousel is not visible. Only Commenting out the first requestAnimationFrame (there are others for later steps) would make the transition progress to I'm not sure if there is a clever way to wait for all transition to finish before calling nextTick, it might add too much complexity to the library. I'll leave with @calebporzio since removing the first requestAnimationFrame could lead to unexpected side effect that I haven't considered. The alternative solution is to update the doc to make clear that nextTick runs before transitions. |
The patched version seems to work perfectly. I'm not quite seeing the animation on the text, only sometimes does it play. I can see the animation between the tabs and reactivity works and I can't seem to cause the text / sliders to disappear. I don't think changing the functionality of nextTick would be right as the way I see it, simply nextTick is to perform an action after the data is set, but in this case it would be after transition.show() has fired. I think maybe another magic property is needed, but what that is called I'm unsure.
Or
So you could do:
What do you think? |
@TomS- I agree with not touching $nextTick and even changing the transition like the patched version doesn't feel quite right. There are too many assumptions so a different library could still break. $transition could be a solution but there is something that scratches the back of my head. This $transition would be only available when the component has at least one element using transitions and it would be a callback stack, I assume. What if each stages of the transition (start/show/hide/end) fires a custom event (i.e. transition-end)? |
@SimoTod I think that's a perfect idea. Custom Events would be a very simple solution, especially since you can define on which transition too. I guess it's just to @calebporzio to agree now. So far it's looking good. What was the solution to fixing the animations disappearing? as this seems like seperate issues. Was it down to it not cancelling the current animation being played? I do wonder if you have 2 sets of animations in a component would it cancel all animations? How would it know that there are animations that act together. I think using |
I haven't done any code changes for slow transitions. UPDATE |
Thanks @SimoTod that demonstrates the issue perfectly. |
Thanks for digging deep on this everyone. I agree that option 1 is the only way to go. I would really appreciate an attempt at an implementation, or a PR at least exploring solutions. The transition system is a little wonky to wrap your head around, but I really think it's a solid system that would allow for something like this. Thanks again |
@calebporzio Unfortunately I'm not clued up enough with JavaScript to be any use on this. I have created another example: https://codepen.io/TomS-/pen/VwLyPyp This is if your put 1 character in Name: and 1 character in Email: then click a sport, "Subscribe" should animate in, which it does but then disappears right away. This is different to the examples shown above, but another example where the animation api is failing. |
@HugoDF I've updated the codepen where we experienced the issue with slow transitions and it seems sorted now. https://codepen.io/SimoTod/pen/zYGoNLO I think we can close this ticket. If something is still missing, we can reopen a new issue and start a new discussion. |
Cool, if there are still issues feel free to reopen |
This post was originally about implementing transition lists (https://vuejs.org/v2/guide/transitions.html#List-Move-Transitions), however, the more I use transition, the more I realise that they are slightly buggy and may need work.
I feel like I really good thing to implement is a way of queuing animations so it doesn't happen all at once (https://vuejs.org/v2/guide/transitions.html#Transition-Modes) see "in-out" and "out-in". Maybe you can add x-transition to a template tag for this to work.
For the bugs that I have come across:
The text was updated successfully, but these errors were encountered: