ahmed-wagdi / angular-joyride

A lightweight joyride directive for giving tours of your AngularJs application
MIT License
17 stars 9 forks source link

If no selector is found, should skip to the next step #17

Closed Deklin closed 7 years ago

Deklin commented 7 years ago

Or at least an option for this is recommended.

ahmed-wagdi commented 7 years ago

I don't quite see the need for this. If the selector isn't found then either a) The developer misspelled it, in which case the current version handles it fine (switches to the default step type and logs a warning for the developer). Or b) there are certain cases where the element is dynamically removed from the DOM, in which case you have access to the steps array and you can manipulate it as you like.

If this is causing a problem for more people and there are cases where handling it manually gets tedious then I'll work on implementing it.

Deklin commented 7 years ago

@ahmed-wagdi that is not quite true, the selector may not be around due to ng-if changes, ng-class changes based on certain UI conditions, OR the selector (when using :visible) may not be visible due to responsive layout changes.

Here is an example on how I handled it using angular-ui-tour

https://github.com/benmarch/angular-ui-tour/issues/141

ahmed-wagdi commented 7 years ago

Yes but most of these cases can be handled manually by the developer. Not to mention that there are too many "what if" cases to handle, for example:

And more i probably haven't thought of. As it is right now it might require you to write more code to handle these cases but atleast it gives you the flexibility to handle it in the way that best suites your app.

It is possible to implement this feature but it would overcomplicate the code base and the only way i can think of implementing this wouldn't be very efficient. I also don't think that the cases where the missing element is constantly being toggled (which might make it a bit more tiring to handle manually) are very common, usually the elements that are highlighted in the joyride are key elements on the page that don't change often.

Deklin commented 7 years ago

No problem, thank you for the consideration.

A lot of this could be solved using jquery selectors and skip if no match, that wouldn't overcomplicate it but would require you to support jquery selectors (optionally if jquery exists perhaps)

ahmed-wagdi commented 7 years ago

Ya i want to avoid including jquery but it wouldn't really solve it anyway, just instead of: if(!$(element_selector).length) i would do this: if(!document.querySelector(element_selector)) That's not really the problem. I'm closing this for now but if more people have the same problem and it can't be solved easily with custom code then i'll reopen it.