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

What is the best practice to cancel tour if user click back browser button? #44

Open
jarooda opened this issue Apr 22, 2022 · 2 comments
Labels
question Further information is requested

Comments

@jarooda
Copy link

jarooda commented Apr 22, 2022

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?

@jarooda jarooda changed the title How to cancel tour if user click back browser button? What is the best practice to cancel tour if user click back browser button? Apr 22, 2022
@RobbieTheWagner
Copy link
Member

@jarooda I am not sure what you mean here. If the user clicks the back button, wouldn't the tour go away on its own?

@RobbieTheWagner RobbieTheWagner added the question Further information is requested label Apr 24, 2022
@jarooda
Copy link
Author

jarooda commented Apr 24, 2022

hi @rwwagner90 , I create a reproduction of my bug here https://github.com/jarooda/test-vue-shepherd

step to produce

  1. run app
  2. go to /about using link in nav

Screen Shot 2022-04-25 at 04 57 02

3. click back using browser button

Screen Shot 2022-04-25 at 04 57 08

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants