Here is a screenshot from one of the Open Atrium 2 tours:

If you do as instructed and click "Group" it will actually end the tour. :-/
The reason is that the tour functionality is dependent on ?tour=tourname&step=X in the URL string, but if the user follows the URL (or submits the form or whatever) themselves, it won't be present:


I've created a patch to Bootstrap Tour that does the following things:
- Stores the current tour name in the session, it knows what tour the user was on if they wander off.
- If the user shows initiative and goes to the next step themselves, it'll advance the step counter.
- And if the user goes to a totally unrelated URL, it'll show a message saying they've wandered off from the tour and give them the option to return or end the tour:
I'll attach the patch in a moment (I need the issue nid)!
Comments
Comment #1
dsnopekPatch is attached! Please let me know what you think.
Comment #2
mcrittenden commentedAwesome, thanks for the patch!
Before reviewing and committing, I wanted to mention one thing. Bootstrap Tour supports "reflex" mode per step which makes it so that clicking on the element that is being pointed at continues the tour just as if you had clicked the "Next" button. See http://bootstraptour.com/api/ and ctrl+f for "reflex" to see the option.
Maybe turning that on for all steps would help this this? I still think the dialog to confirm leaving the tour and storing the current tour state in the session are smart additions in general though. What do you think?
Comment #3
dsnopekI haven't tried "reflex" mode, but looking at the docs, it seemed that was meant for tours that stay on the same page. We can try it!
But also, we don't necessarily know that the users will get to the next page by clicking the element. For example, if it's a content creation form and we're are pointing at the "Title" element (or some other random bit of the form) and the user goes all the way to submit the form, we should take them to the step that is on the following page, regardless of it they clicked the element or not. So, it's about catching up with the user when they showed initiative and did what the tour said, but that can go off the current page.
Comment #4
mcrittenden commentedAwesome, thanks again for this great patch. Pushed to 7.x-1.x in 4c87f68.
Comment #5
dsnopekThanks! Sorry, I never got around to testing 'reflex' but I still plan to! I suspect it won't make sense to be on by default, but it might be useful as an option you can select for some steps. I'll need to mod-up some real tours (probably the OA tours) and see it in practice, though. :-)
Comment #6
spazfoxThis feature, at least as implemented in 7.x-1.0-beta7, is very buggy. I'm having so many issues with it that I'm not even quite sure how/where to begin documenting them. Basically, though, the "you have wandered off from the tour" message is popping up all the time (and seemingly at inappropriate times) and I seem to be unable to cancel the tour at all. It is has rendered this module unusable for me, and I'll need to roll back to a previous version until this is fixed. I'll try to provide more extensive and clear documentation of what I'm experiencing when I get a chance. Is this feature working correctly for anyone else?
Comment #7
dsnopekThis is has been working for me on Open Atrium with the tours it bundles. I haven't done much testing outside of that context, though.
Can you create a Feature which has one of your problem tours (or minimal steps to create a problem tour) and give the steps to reproduce?
Since I created the original patch, I feel responsible for getting to work right. :-)
Comment #8
spazfoxI don't have any experience creating Features, but I'll look into doing that if it would help. Has this been tested on a vanilla Drupal 7 install at all? It is behaving very erratically for me (unable to end tours at all, tours resuming at strange times for no reason, tours do not begin on the correct step, the "leaving tour" warning window displaying when it shouldn't, etc.). The module was working fine before beta7.
Comment #9
spazfoxComment #10
mpotter commentedI am also experiencing some bad behavior from this patch in the OA 2.15 version.
When in a space that has a custom domain, this is getting the session from the wrong domain. This causes tours to popup in weird places. In particular, it can cause bootstrap_tour.js to get executed on system/ajax urls, which then breaks the ajax callback stuff. I have a very obscure case with media browser that is exhibiting this behavior that I traced to this path.
Because of this and the other issues being reported, I am going to revert this patch for now.
Comment #11
dsnopekI talked with Mike Potter today about a reproducible case where tours would start unexpected when using a single site that accessible at multiple domains. Since it's reproducible, I'll look into when I have a chance - new issue here: #2207737: Tours unexpected return on sites with multiple domains
@spazfox: Since I can't reproduce your problems, there's nothing I can do. However, if you post steps to reproduce, I'd be happy to take a look!
Comment #12
dsnopekEr, I didn't realize that this was actually reverted in Git! I just assumed Mike was reverting OA to an older version. In that case, my new issue doesn't actually make sense, and I'll work on it in this issue.
Here's the information I had put on that:
Comment #13
spazfoxI haven't had time to try to provide reproducible steps on a clean install yet, but in case it is related, I should note that my entire site is running through HTTPS. There is no switching between HTTP and HTTPS, so session cookies should not be lost because of that, but is there something about having secure sessions that could be impacting the patch in this thread? I am not using multiple domains on my site.
Comment #14
dsnopekWell, switching between HTTP and HTTPS would have the same effect as switching domains would. But since you're not doing that, there really isn't anything about being on HTTPS that could have an effect. The main site I'm using this patch on is also HTTPS only, and there are no problems. :-/ Anyway, I'll look into the issues Mike Potter found soon and maybe (if we're lucky!) it'll fix your problems too. :-)
Comment #15
dsnopekOk, here is an attempt to fix the issues that Mike Potter found. Mike can you try this with your use case? I was able to reproduce lots of weirdness with multiple domains, but not the exact system/ajax Javascript error that you had... If it's still present I may need some more info on reproducing it.
I've also included an interdiff too so you can see what I added.
@spazfox: If you have the time to test and see if this has any affect on your problems, that'd be nice too!
Comment #16
dsnopekThere are still some issues with my patch for tours with only one step (like the "Welcome to OA2" tour). I'll make a fix soon!
Comment #17
dsnopekOk! I've got a new patch that fixes a number of things:
The new patch is attached along with an interdiff from the last one!
I also found a number of weird problems with the Open Atrium tours, which turned out to be problems with those tours themselves - see these PRs for an explanation and fix (already merged):
https://github.com/phase2/oa_core/pull/59
https://github.com/phase2/oa_core/pull/60
At this point, my patch works for me with all the Open Atrium tours AND allows you to actually follow the tour instructions WITHOUT losing the tour! It also doesn't have any problems I can reproduce with multiple domains.
Please review when you have a chance!
Comment #18
dsnopekAh, sorry, I uploaded the wrong patches! :-/ These should be the correct ones. Please just ignore the patches on #17, those were from yesterday before I discovered some of the problems mentioned in that comment.
Comment #20
mpotter commentedThanks, I appreciate the work on this!
Committed to e276a7d.