Skip to content
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

It should be possible to open a Link in a new tab using browser default behavior #1248

Open
rmarscher opened this issue Feb 19, 2025 · 2 comments · May be fixed by #1249
Open

It should be possible to open a Link in a new tab using browser default behavior #1248

rmarscher opened this issue Feb 19, 2025 · 2 comments · May be fixed by #1249

Comments

@rmarscher
Copy link
Contributor

We always preventDefault() on our Link component. I think we should have an option to allow a meta-click to follow the default browser behavior.

@dai-shi
Copy link
Owner

dai-shi commented Feb 19, 2025

I wonder if we can implement it without having an option.
Is having an option a common approach in other frameworks?

@rmarscher
Copy link
Contributor Author

I thought maybe you liked adding options with unstable_ prefix to tentatively try a new behavior before committing to it. I see your comment from #791 though. "prefer less options"

I'll take a look at React Router and TanStack Router. I don't think React Router has an option. I found where they have code that is pretty much the same as what I added here. https://github.com/remix-run/react-router/blob/react-router%407.2.0/packages/react-router/lib/dom/dom.ts#L30-L43

It looks like there might be a few other good ideas that we are missing.

Reference:
https://github.com/remix-run/react-router/blob/react-router%407.2.0/packages/react-router/lib/dom/lib.tsx#L1278
https://github.com/TanStack/router/blob/main/packages/react-router/src/link.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants