Comments (8)
Ok, I think I understand what's the problem. It shouldn't even start listening to NavigationStart
event if it didn't navigate anywhere (isRouteActive == true
).
from ngx-ui-tour.
Not sure if it's more sensible to try to guess which step should be selected or to just end the tour. I am leaning towards just ending the tour since there might no longer be an anchor element or the step might require pressing UI element which might cause issues when pressed multiple times.
from ngx-ui-tour.
Maybe some kind of confirmation modal in this case?
Or an option for what to do in such cases?
Btw, a similar issue is when no backdrop is shown and fragment is changed - tooltip disappears, but tourService status - on
from ngx-ui-tour.
Btw, a similar issue is when no backdrop is shown and fragment is changed - tooltip disappears, but tourService status -
on
@hakimio, What do you think if adding a check into setCurrentStep
function to only hide the step if url is not active or anchor isn't available:
private setCurrentStep(step: T): void {
this.currentStep = step;
this.showStep(this.currentStep);
this.router.events
.pipe(filter(event => event instanceof NavigationStart), first())
.subscribe(() => {
if (this.currentStep && this.currentStep.hasOwnProperty('route') && (!this.isActiveRoute(step) || !this.anchors[step.anchorId])) {
this.hideStep(this.currentStep);
}
});
}
private isActiveRoute(step: T) {
if (!step.route) {
return true
}
const url = typeof step.route === 'string' ? step.route : this.router.createUrlTree(step.route),
matchOptions: IsActiveMatchOptions = {
paths: 'exact',
matrixParams: 'exact',
queryParams: 'subset',
fragment: 'ignored'
};
return this.router.isActive(url, matchOptions);
}
from ngx-ui-tour.
Not sure what you are trying to achieve here.
Anyway, I have decided to just end the tour if user navigates to a different page.
You can use route guard to prevent user from being able to navigate to a different page when tour is active.
from ngx-ui-tour.
Example: Tooltip is shown on the left menu and the user switches tabs on the right side (fragment only changes in url - someUrl#tab1 => someUrl#tab2)
from ngx-ui-tour.
One more thing I noticed is that there are subscriptions to this.router.events
in setCurrentStep
and no unsubscribe.
It seems that with time and going back and forward between steps may cause lots of subscriptions that would be attached and stay there forever. Even when the tour is finished.
from ngx-ui-tour.
It's using first()
operator to unsubscribe after the first emition.
from ngx-ui-tour.
Related Issues (20)
- 🐞 - [Ionic] Unable to use side:"top" placement HOT 6
- 🐞 - [md-menu] step width can not be increased above 280px HOT 6
- 🐞 - the library fails to build when TypeScript `strict` mode is enabled HOT 3
- 🐞 - [v9] incorrect scroll position when going to previous step HOT 4
- 🚀 - Additional parameter for hideTourStep to indicate if the next or previous step is already available. HOT 7
- 🐞 - Backdrop is not positioned properly when developer console is opened HOT 10
- 🚀 - Tour should be cancelled when the target element is destroyed. HOT 10
- 🐞 - HOT 9
- 🐞 - `currentStep` is undefined after calling `tourService.start()` HOT 6
- 🚀 - Add support for `prime-ng` library HOT 3
- 🚀 - Add `asyncStepTimeout` setting HOT 1
- 🐞 - Backdrop taller than scroll container when anchor element exceeds scroll container's height HOT 3
- 🚀 - Replace centerAnchorOnScroll by postitionAnchorOnScroll HOT 3
- 🐞 - [md-menu] `nextOnAnchorClick` not working with `closeOnOutsideClick` HOT 1
- 🚀 - Change Defaults Override HOT 1
- 🚀 - Support Angular 17 HOT 1
- 🐞 - [Ionic] tour end button is not working for one of the tour steps HOT 6
- 🐞 - [service] Tour won't open again after pressing the "prev" button and then closing it (with optional first step) HOT 2
- 🐞 - Ionic Version 3 doesn't support Ionic Non-Standalone Ionic Apps HOT 6
- 🚀 - Multi Tour and Execute function before loading step. HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-ui-tour.