-
Notifications
You must be signed in to change notification settings - Fork 36
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
incorrect isOrphan Step detection under certain conditions #49
Comments
Thanks for your very clear report! I've been caught up with other things recently so haven't had time to look at this properly (or the other couple of reports currently open). I'm starting to think that something has been missed in the step reload flow, possibly because of the way the step.element has to be handled due to the legacy Tour code. For info, the legacy Tour code mangled the step.element, switching it back and forth between string literal and jq object. I had to work around this when implementing the "step element as function" feature, so it's possible I've introduced a bug. Your report is for a different issue but I think yours and this report are symptoms of the same root cause: #44 I'll try to take a look soon, unfortunately it may be a little time before I can get around to it. If you'd like to try fixing it I'll be happy to help guide you, I just don't have access to a machine and the code at this min. |
Thank you for getting back to me. I'm more than happy to try to resolve the issue and appreciate your offer for guidance. I'll be in touch. |
I've had some trouble identifying where exactly the step.element is being mangled due to string literal and jq object switching. Propose to change _showPopover function (at around line 1236) from:
to:
Thoughts? |
Ive also taken a quick look at issue #44 since you indicated it may be somewhat related. I'll comment further directly in that issue. |
Thank you for working on this. I'll need to take a quick look at the code to give you exact locations and feedback on this, so a quick signpost for now and hopefully some more specific feedback tomorrow.
In the step show flow, after the step is loaded the step.element is checked for typeof function and evaluated. The result is then put back into the temporary "live" step.element. This was necessary because (I believe, off the top of my head) the original showStepHelper and other areas of code switches between using On your suggestion for setting orphan, that makes sense but let me double check the code flow please. I think there might be a case where keeping step.orphan intact is necessary so that a comparison between step.orphan (the intended setting for the step) and the result of isOrphan() (the real current orphan status of the step) is needed. Thanks again for your work on this and #44 |
Apologies, this took a bit longer than expected. Thanks again for your feedback. First, step.element mangling. For info, the logical flow for step management is as follows:
Part 1: in Of course, this has a side effect - the code doesn't check that the returned value of the Part 2: in Ideally I want to work through all the step management code and hold step.element in its original form as per step option, and manage the "live" element at runtime through a specific, validated $element object. That will clear up some confusion and make future features easier, but it's a bit of a painstaking process to check how it's used in every case. On your orphan suggestion, as I suspected it's not quite as straight forward as we'd hope (again because of legacy code). Line 1221 has Orphan status is checked in multiple ways unfortunately - by step option, by the isOrphan() function , and by a variable that's held following an isOrphan check (like line 1221). Changing the step option to reflect orphan status I think will cause some unintended side effects and prevent unintended orphan detection. My principle going forward is to not alter the step options. Instead I want to track things like this through the step flags (see line 385 There's clearly an underlying bug here though that I need to work on. Let me know your thoughts - and I'll take a look at the other issue later. Thank you for your feedback! |
firstly, thank you for bootstrap-tourist. It looks very promising and I cant wait to play with it properly.
I've just set it up on one of my sites just to see how much I can break it and have come across what I believe is an incorrect isOrphan detection.
Created the tour and added 2 steps with both steps intentionally assigned to non-existent elements.
I added some further debugging in the code to check the isOrphan function and then launched the tour.
when the tour starts, the first step is positioned correctly in the center of the page and the debugging output shows:
I click the next button and step 2 displayed as intended (ie, it satisfied all the conditions to be declared an orphan).
I then click the back button and this is where the strange behaviour comes in. The step (step 1) is again displayed however it is now positioned at the very top of the page and the step.element, instead of being '#img1' is 'body'
debugging output is as follows:
from here on in, moving through the tour, whether forwards or backwards, the steps stay positioned at the top of the page and the step.element remains assigned to 'body'.
I hope I've made sense :)
The text was updated successfully, but these errors were encountered: