-
Notifications
You must be signed in to change notification settings - Fork 659
Tour onError callback doesn't fire on showStep with bad target #274
Comments
Oops- it might also be nice to include the line |
Huh... it would make sense that This probably won't be fixed in the current codebase, but the ES6 Refresh milestone should address this issue. |
Thanks zimmi... I believe I made a simple fix for this in our project, which I'd be happy to turn into a PR at some point, just let me know when/how/where. |
If there's a patch ready to go, I'll consider it for the 0.2.6 maintenance release. (Previously, there wasn't a plan for a maintenance release, but we have enough PRs where it's worth it to make a new release.) Feel free to submit a PR and I'll take a look. Thanks! |
I've posted a PR for this, hopefully it's good. |
* Add error callback for showStep Calling showStep without a proper step target fails, but the tour error callback is not invoked. This change fixes that, and sets the current step number to the step that failed for debugging purposes * Revert step num after error callback Not sure if this will work * remove all stepNum stuff, see if it still breaks just a test to see what's breaking * Add templates stuff * Revert "Add templates stuff" This reverts commit 8dfed46. * Resubmit error callback patch temporarily set currStepNum then revert * deglobalizing temporary var * Hoist temp var to top of function
According to the use guide, we can provide an
onError()
callback for errors in which the target for a given step is not found. It seems like this callback doesn't fire in the case where theshowStep()
method is used.CodePen example: http://codepen.io/trav_stone/pen/NNjJjW
After looking at the source briefly, it seems like this might be remedied by adding the following around line 1963 of hopscotch.js ( within the definition of
this.showStep
, in theif
clause specifyingfalse
as the value ofutils.getStepTarget(step)
):utils.invokeEventCallbacks('error');
I'm not incredibly familiar with all the bits and pieces in there however, so perhaps there's a better approach.
If the
onError()
callback is not supposed to work with theshowStep()
method, can someone let me know why? Otherwise I think there's a wee bug in there.The version I'm working with is hopscotch - v0.2.5
Thanks for an otherwise spectacular library!
Trav
The text was updated successfully, but these errors were encountered: