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

Middle-click broken on Safari #3019

Closed
mleonhard opened this issue Nov 11, 2020 · 5 comments
Closed

Middle-click broken on Safari #3019

mleonhard opened this issue Nov 11, 2020 · 5 comments
Labels
C-bug 🐞 Category: unintended, undesired behavior

Comments

@mleonhard
Copy link

Describe the bug
Middle-clicking on package links no longer opens new tabs. It behaves like a regular click, following the link in the current tab. This interferes with my browsing habits.

To Reproduce
Steps to reproduce the behavior:

  1. Open Safari
  2. Browse to https://crates.io/search?q=crates-io
  3. Middle-click on the first result, crates-io.
  4. The browser navigates to the url of the link https://crates.io/crates/crates-io . It doesn't open a new tab.

Expected behavior
Browser opens a new tab showing the url of the link, https://crates.io/crates/crates-io

Desktop (please complete the following information):

  • macOS 10.15.7 x86 64-bit
  • Safari 14.0

Additional Info
The bug does not occur in Firefox 82.0.3 or Chrome 86.0.4240.198.

The bug occurs only on links to package pages. Middle-clicking on other links on crates.io pages opens them in new tabs.

Thanks for maintaining crates.io. It is very useful to me. -Michael

@mleonhard mleonhard added the C-bug 🐞 Category: unintended, undesired behavior label Nov 11, 2020
@Turbo87
Copy link
Member

Turbo87 commented Nov 12, 2020

I'm having a hard time figuring out what could be causing this. We are attaching an event handler to the click event which prevents the default link action from happening, but according to MDN the click event should only be triggered when clicking the primary mouse button. Could it be that your Safari version has a bug and sends out click events for the middle mouse button too?

@dbalcomb
Copy link

This has recently become a regular annoyance for me. I don't remember this happening before but I can only assume that is because the click handler is a recent addition.

I am also running Safari 14.0 on macOS 10.15.7 and from what I can tell this isn't a bug but rather a limitation of the browser. It appears that Safari does not yet support the auxclick event which is used to detect clicks that are not from the primary mouse button. This used to be the case for Chrome and Firefox until they introduced support which allowed them to redefine the click event to not fire on middle clicks.

There is an older webkit issue here that has not yet been resolved. In the meantime it looks like you can use the button or which event properties to figure out if it was the primary mouse button or not.

@buschtoens
Copy link

I'm sorry 🙈

buschtoens/ember-link#6

Will implement a fix on Monday latest, if nobody else gets to it before me.
Thanks for pinging me @Turbo87!

@sagebind
Copy link

I'm not sure if this is the same issue or not (it seems to be) but ctrl+click no longer opens package links in new tabs for me in Firefox on Windows. Personally it annoys me easily when websites do not respect the normal ctrl+click behavior since this is something I use quite often in my day-to-day web browsing, and only doesn't work if you're intercepting links with snazzy JavaScript...

@Turbo87
Copy link
Member

Turbo87 commented Nov 16, 2020

should be resolved once #3029 is deployed :)

@Turbo87 Turbo87 closed this as completed Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug 🐞 Category: unintended, undesired behavior
Projects
None yet
Development

No branches or pull requests

5 participants