-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: angular, routerLink prevents opening link in new tab #24413
Comments
Thanks for the issue! This issue has been labeled as Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed. If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue. For a guide on how to create a good reproduction, see our Contributing Guide. |
@liamdebeasi added the reproduction repo link to the issue. |
Thanks! I can reproduce this behavior. For additional context, this Ctrl+Click behavior works with the standard routerLink in an Angular app without Ionic, so I think we should support this. |
If it helps, i can create a PR with a fix. |
This issue has been labeled as If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort. For a guide on how to create a pull request and test this project locally to see your changes, see our contributing documentation. Thank you! |
Yes, that would be great! Just as a heads up, much of the team is taking time off for the upcoming holidays in the United States, so we may not get to your PR right away. |
I have the same issue with Ionic and VueJS, cmd+click on a link does not allow opening in a new tab |
@maelp can you share more information about the problem you are facing in Vue? This issue is tracking router links not working as expected with native HTML elements ( Quickly checking with Vue, CMD/CTRL + click works under these conditions: <router-link to="/routing/child">
<button>button</button>
</router-link>
<router-link to="/routing/child" custom v-slot="{ navigate, href }">
<a :href="href" @click="navigate">link text</a>
</router-link> |
Well for me, when I add a regular |
Correct, that is currently the expected/default behavior. If you wouldn't mind opening a new issue to track that request change, that would be appreciated. I don't have a strong stance at the moment if The scope of this issue is around fixing the behavior of an |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
Current Behavior
When importing the IonicModule and using
[routerLink]
,the following line prevents Ctrl+Click behavior on Desktop browsers.
ionic-framework/angular/src/directives/navigation/router-link-delegate.ts
Line 56 in 732f8e1
Expected Behavior
Ctrl+Click should trigger the default browser behavior (e.g. open the link in a new tab/page/etc).
Steps to Reproduce
[routerLink]="[<your link>]"
Code Reproduction URL
Link to repository
On the home page CTRL+Click the link
Ionic Info
Additional Information
I'm currently monkey-patching it 🙈 .
Maybe this can be fixed by something like (pseudo-code)
The text was updated successfully, but these errors were encountered: