Crates.io: Middle-click broken on Safari

Created on 11 Nov 2020  路  5Comments  路  Source: rust-lang/crates.io

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

C-bug

All 5 comments

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?

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.

I'm sorry 馃檲

https://github.com/buschtoens/ember-link/issues/6

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

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...

should be resolved once #3029 is deployed :)

Was this page helpful?
0 / 5 - 0 ratings