pattern-library
pattern-library copied to clipboard
axa-link reason for onClick's event.preventDefault() ?
Axa-link is preventing default event on click. This is documented.
As this is counter-intuitive (compared to dom's anchor element), I am missing reason for this behavior.
From my consumer point-of-view, this is a downside, because it forces me to use both href
attribute (for usability) and call in onClick handler the history.push() again, so that the navigation even works. (As I am attaching other functionality in onClick handler also).
Ideally, there would no e.preventDefault() be called in axa-link at all. As I can do that myself when I need to. As the event is passed down already since v 4.2.23, see:
Thanks!
I think we had this issue already at some point, no?
I don't remember the reason. Maybe it was the consideration of the external
attribute. But I currently don't see why we should not do that.
Since this is a feature request, I have to discuss it with @markus-walther and he is on vacation for this and next week.
Discussion: We should leave preventDefault as default behavior, but add an attribute to disable this behavior.
@MarekLacoAXA I agree with you.
The User should also just know that he has to use the ev.preventDefault();
himself if he does not use link natively.
I will remove prevent default and also window open.
It will be breaking change and new major version.
I approve of the decision of @MKaHead - it makes a lot of sense and simplifies the component.