-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
Description
When starting a tour the first step does not display until the callback provided to tour.onBeforeChange()
resolves.
On subsequent step changes the tour does not wait for the callback provided to onBeforeChange()
to resolve.
I created a codepen which demonstrates this bug, and also provided the code below to replicate it yourself.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<button type="button">Start</button>
import introJs from "intro.js";
const tour = introJs.tour();
const button = document.querySelector('button')
tour.setOptions({
steps: [
{element: 'li:nth-child(1)', title: 'first'},
{element: 'li:nth-child(2)', title: 'second'},
]
})
tour.onBeforeChange(onBeforeChange)
button.addEventListener('click', () => tour.start())
// This delays first step but not subsequent changes
function onBeforeChange () {
return new Promise((resolve) => {
setTimeout(resolve, 5000)
})
}
This doesn't appear to be the way the code in steps.ts
is intended to function - which makes me wonder if there's a compiler error.