shipshapecode / shipshapecode/vue-shepherd
What is the best practice to cancel tour if user click back browser button?
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 340
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
I can prevent user for clicking other button component that route to outside current component using overlay.
But if user clicking back browser button, the tour is still running.
so i use navigation guard and search the classname like this
beforeRouteLeave (to, from, next) {
const tourOverlay = document.getElementsByClassName('shepherd-modal-is-visible')[0]
const tourStep = document.getElementsByClassName('shepherd-enabled')[0]
if (tourOverlay && tourStep) {
tourOverlay.remove()
tourStep.tourStep()
}
next()
}
Is there a best practice to achieve this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the beforeRouteLeave guard shown in the issue and the Shepherd modal and step elements it identifies. Trace how browser-back navigation reaches this guard and determine the expected cancellation behavior; done means navigating back stops the active tour without leaving its overlay or step elements behind.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100