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 is broken when using sync mode and popstate events #559

Closed
Tracked by #703
xavierfoucrier opened this issue Sep 7, 2020 · 4 comments
Closed
Tracked by #703
Assignees
Labels
await test repository waiting for a minimal test repository @barba/css bug

Comments

@xavierfoucrier
Copy link
Member

When using the @barba/css plugin with the sync mode option, it looks like the .active class doesn't properly show up when navigating with the backward browser button.

barba.init({
  transitions: [
    {
      name: "home",
      sync: true,
      to: {
        namespace: ['home']
      },
      once() {},
      leave() {},
      enter() {}
    }, {
      name: "fade",
      to: {
        namespace: ['fade']
      },
      leave() {},
      enter() {}
    }
  ]
});

For example, navigating from home.html to fade.html will properly fade the content and display the next page, but going back to the home.html page will lead into this issue, where the .home-enter-active class is missing on the next container, breaking the transition:

image

Finally, the .home-enter-to class stay on the next container, even after the transition end.

Note that this is only happening in sync mode when the page that is using a synced transition to go to is loaded first, at once hook.

@stale stale bot added the wontfix label Nov 7, 2020
@barbajs barbajs deleted a comment from stale bot Nov 24, 2020
@stale stale bot added the wontfix label Jan 23, 2021
@stale stale bot added the wontfix label Jun 9, 2021
@barbajs barbajs deleted a comment from stale bot Oct 18, 2021
@barbajs barbajs deleted a comment from stale bot Oct 18, 2021
@xavierfoucrier xavierfoucrier added the await test repository waiting for a minimal test repository label Jan 31, 2022
@xavierfoucrier xavierfoucrier self-assigned this Jan 31, 2022
@gfnool
Copy link

gfnool commented Feb 14, 2023

Hi @xavierfoucrier! Any news about this fix? Or can you suggest a workaround in the meantime?

@xavierfoucrier
Copy link
Member Author

Hello @gfnool, I am not using a lot @barba/css, that's probably why I haven't investigate on this currently. Keep watching 😉

@xavierfoucrier xavierfoucrier changed the title Next container active class is missing when using sync mode and popstate events Transition is broken when using sync mode and popstate events Mar 15, 2023
@xavierfoucrier
Copy link
Member Author

Hello @gfnool 👋

I pushed a fix a few minutes ago, would be great to have your feedback on this!

On my side I tested with two pages A + B:

  • fade out/in transition for A ➡️ B
  • fade out/in synced transition for B ➡️ A

Using both link and popstate events, everything is working fine.

Let me know! 😉

@gfnool
Copy link

gfnool commented Apr 17, 2023

Thanks @xavierfoucrier and sorry because I didn't test it yet. Next project I will give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
await test repository waiting for a minimal test repository @barba/css bug
Projects
None yet
Development

No branches or pull requests

2 participants