-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Only handle "normal" clicks on <Link>s #3056
Conversation
Prevents Link onclick behaviour from executing if the Ctrl key (for Windows and Linux) or Meta Key (For Mac) is pressed. This technically introduces a bug that means that links will reload the page on windows machines when the windows key is held down. However, this error is also in React Router, so I think we can get away with it. See: https://github.com/remix-run/react-router/blob/11156ac7f3d7c1c557c67cc449ecbf9bd5c6a4ca/packages/react-router-dom/dom.ts#L29
This change is inspired by https://github.com/remix-run/react-router/blob/11156ac7f3d7c1c557c67cc449ecbf9bd5c6a4ca/packages/react-router-dom/dom.ts#L2://github.com/remix-run/react-router/blob/11156ac7f3d7c1c557c67cc449ecbf9bd5c6a4ca/packages/react-router-dom/dom.ts#L29 This allows uses to shift click links to save whatever the link points at, and alt click on links to open them in new windows
bb02e63
to
fb534f4
Compare
Visit the preview URL for this PR (updated for commit fb534f4): https://yew-rs-api--pr3056-issues-2911-mn4xsbe3.web.app (expires Thu, 29 Dec 2022 14:30:21 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice and concise solution, looks good to me!
Description
This issue fixes Issue 2911
It uses the exact same approach as React Router
Yew Router's Link's onclick now early returns if any of the following keys are held:
Fixes #2911
Checklist
cargo make test-flow
passescargo make lint
passes