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

Fix issue #1353 : Complete the tour when skipStep is the lastStep #1479

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/js/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,19 @@ export class Tour extends Evented {
}

/**
* Called when `showOn` evaluates to false, to skip the step
* Called when `showOn` evaluates to false, to skip the step or complete the tour if it's the last step
* @param {Step} step The step to skip
* @param {Boolean} forward True if we are going forward, false if backward
* @private
*/
_skipStep(step, forward) {
const index = this.steps.indexOf(step);
const nextIndex = forward ? index + 1 : index - 1;
this.show(nextIndex, forward);
if (nextIndex === this.steps.length - 1) {
this.complete();
} else {
this.show(nextIndex, forward);
}
}

/**
Expand Down