-
-
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
Link component should NOT prevent_default when command + clicked #2911
Comments
If you want to write the PR for this, the place to start should be in the Since the bug is about the control key specifically, https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.MouseEvent.html#method.ctrl_key should get you started to read that from the event, but you can think of other state that deserves handling, like shift, alt (or right-click? that seems to be handled at least in Firefox correctly) too. |
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
* Fixing #2911 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 * Router Links now use default browser behaviour for alt and shift keys. 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
Problem
On macOS,
command
+click
on a link should be handled as open in a new tab.The same behavior is expected for
ctrl
+click
on Windows or LinuxThe current implementation invokes the
prevent_default()
method on the event object without handling these odd cases.Steps To Reproduce
Steps to reproduce the behavior:
<Link />
element fromyew_router
command
+click
on the linkExpected behavior
A new tab should be opened from the link
Environment:
stable
]Questionnaire
The text was updated successfully, but these errors were encountered: