I have issues with back & forward buttons in the browser.
To recreate I have created very simple example. Two html files: test1 & test2, each with a simple link to the other file. Both with barba wrappers / containers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body data-barba="wrapper">
<div data-barba="container">
test 1
<br>
<a href="test2.php">next page</a>
</div>
</body>
<script src="test.js"></script>
</html>
Then a simple transitions initialization:
barba.init({
transitions: [
{
name: 'generic',
priority: 2,
enter() {
console.log('generic enter');
},
}, {
name: 'back',
priority: 1,
custom: ({ trigger }) => {return trigger === 'back'},
enter() {
console.log('back enter')
},
}, {
name: 'forward',
priority: 1,
custom: ({ trigger }) => {return trigger === 'forward'},
enter() {
console.log('forward enter')
},
},
]
});
Now the test scenario is:
I can attach a simple repo should you need it to recreate. Using barba 2.8.0.
Hi @pburdylo,
Thanks for the use case. Note that your script src is outside the body tag.
Will take the time to check all scenarios as soon as possible.
:wink:
Hi @pburdylo,
Thanks for pointing this out.
We need to check barba.history on popstate events.
I will work on it tomorrow and release a quick fix.
Alongside, we will probably consider some refactoring around this history management…
@pburdylo,
It should be fixed in 2.9.3.
And it would be very appreciated if you could check and validate… 😊
Most helpful comment
Hi @pburdylo,
Thanks for pointing this out.
We need to check
barba.historyonpopstateevents.I will work on it tomorrow and release a quick fix.
Alongside, we will probably consider some refactoring around this history management…