fix(angular RouterLinkDelegateDirective): Make routerLink respect target and keyboard modifiers#28976
fix(angular RouterLinkDelegateDirective): Make routerLink respect target and keyboard modifiers#28976j-oppenhuis wants to merge 1 commit intoionic-team:mainfrom
Conversation
…ier is used in RouterLinkDelegateDirective
thetaPC
left a comment
There was a problem hiding this comment.
Thank you for submitting a PR to the project! We appreciate your contribution.
There are a few things that need to be addressed before we can move forward with the PR.
- Command clicking is not following expected browser behavior. While I’m able to
CMD+clickon the button and the link opens in a new tab, the active page navigates to the same url. - The
OPTIONkey is not being taken into account when clicking on the button if the user is using a Mac. The user shouldn't be able to open the link in a new tab and the page should not redirect to the link passed torouterLink. - As a noted in the first item, the page should not redirect to the link passed to
routerLink. The redirection is happening because of a behavior that is implemented inion-button. We would want to prevent Ionic's click listener from triggering when a new tab is opened. - We also want to check the operating system of the user to tie the correct key to the correct action. The
OPTIONkey should only be taken into account when the user is using a Mac.
Let me know if you have any questions! Thank you for your time and effort!
|
Thank you for your feedback. I understand that it is more complex than my initial idea. Instead of changing routerLink functionality, we should probably change the |
|
I have looked into the code and I think my suggestion is incorrect. But it seems we are not able to prevent the button or item navigation by using stoppropagation. The only thing I can think of is adding a |
|
We've checked out the problem, and it's a tough one. But because we're short on time, our team can't really dig into it right now. However, we're up for bouncing around ideas together. We might not have all the answers, but we'll do what we can to help out. I agree that passing an operating system is not the way to go. We want |
Issue number: resolves #26394
What is the current behavior?
This fixes using routerLink in combination with a target different than _self. It also fixes a bug where CTRL + click or shift + click does not work like expected in combination with routerLink in Angular.
What is the new behavior?
When using a target other than _self and keyboard modifiers we are now stopping execution of navigating by routeDirection. This is not needed because the app will reload either way.
Does this introduce a breaking change?
Other information