-
-
Notifications
You must be signed in to change notification settings - Fork 623
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
Unable to preventDefault on route-href when pushState is true #848
Comments
So am I doing something wrong or is this expected behaviour? If so it's a little weird it behaves differently with hashChange. |
Can you try
together with
|
Unfortunately it doesn't change things... here's what my code looks like now: constructor (el, ea) {
this.el = el;
this.ea = ea;
this.onClick = e => {
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
this.ea.publish('route-popup:open', {route: this.route, params: this.params});
};
}
attached () {
this.el.addEventListener('click', this.onClick, true);
}
detached () {
this.el.removeEventListener('click', this.onClick);
} FYI - my use case for this is to have a list of items with normal links ( |
@bigopon any other ideas? |
@powerbuoy did you try it with a The Link will be opened when the |
@Eagle94T I did not. But even if that works it's inconsistent it doesn't work the same with and without pushState |
@powerbuoy Maybe just ignore the router altogether ? adding an attribute |
@bigopon I don't want the router to ignore it though. Most of the time I want the The fact that it works when |
@powerbuoy Can you try the work around described here aurelia/history-browser#32 (comment) |
@bigopon Honestly that's a little more hassle than I'm willing to get this working :P I'll try mousedown first at least. |
@powerbuoy Sure x) it may look like a lot, but it boils down to ensure you register your click handler before all else, even the one from router history browser |
@bigopon Ah I see. I'll take a look at it when I get a chance. This particular feature (open some URLs in popups in some resolutions) has been pushed down on the priority list a bit for the moment. |
I'm trying to prevent a link with a
route-href
attribute from navigating to the new URL.When I configure the router to use
hashChange
instead ofpushState
it works fine. But if I switch topushState
preventDefault()
does nothing:<a route-href="route: item; params.bind: {id: item.id}" prevent-href>${item.name}</a>
The text was updated successfully, but these errors were encountered: