Middle clicking a link twice does not work as expected


(Hugo Almeida) #1

I would like to see if someone can reproduce this,

Its funky on Firefox and Chrome, so lets say you have a link
google 1

if i middle click once on it will open a new tab, if i middle click it again the cursor will get stuck on drag navigation. If you let left click in place to go away you’ll end up clicking the link again.

On Firefox its worse, because if you close the new tab by accident it won’t let you open with middle click and just be stuck at drag navigation.
On Chrome you’ll be able to middle click and it will open in new tab but be stuck at drag navigation.

I know its kind of weird use case, but is even more weird and frustrating to be stuck in drag navigation.


Another thing I’ve noticed, but not sure if bug or browser feature.

In Chrome, middle click will open new tab but keep focus on current page, while in Firefox it will open new tab and switch focus.

I’ve also tried going to google with Firefox and in this case middle click would open new tab but keep focus on current page.

The use case here is about a post with 2 links that i want to open while i keep reading the post.
google 1 and google 2


(Jeff Atwood) #2

Why do you need to middle click the same link twice?


(Hugo Almeida) #3

Don’t really need, but sometimes i miss-click twice and get stuck with drag navigation.

Just reporting what i found strange/not expecting.


Adding to that, my main problem is the fact you get stuck with drag navigation, and that breaks all the expectations. So you’re reading a post and browsing and for some reason you miss-click a link twice then you keep moving your mouse, now the page is going all over the place breaking the flow and making me cringe.

Similar to what happens when you middle-click and move too fast, instead off clicking the link it starts moving the page all around.


(Jeff Atwood) #4

Yes, but middle click weirdo drag navigation is a “feature” of Windows, as you can see here, and can rarely be disabled even at the OS level.

No way to be disabled in Chrome, and specific to Windows. Does not happen on OS X at all.


(Hugo Almeida) #5

Not saying its a major bug or anything, probably not even worth the effort to hunt down.

But i do think getting stuck on AutoScroll after clicking a link twice is not by Windows or the browser design, since it seems to only happen on discourse and not other webpages in different browsers.


(Tom Piddock) #6

I can expand on this. This actually is a replicatable bug:

To replicate in IE9.

  1. Create post with link.
  2. Middle click link.
  3. Goto new tab (focused automatically)
  4. Return to post tab. See that “Click count” has increased.
  5. Middle click link again -> Autoscroll intialises and link is not clicked.
  6. Middle click without moving from link, Autoscroll ends and link is opened in new tab.
  7. Jeff Atwood tells me I have a nice hat.

(Jeff Atwood) #7

That is a very, very nice hat you have there.

(However note that IE9 is supported, but barely as our absolute minimum sort-of-works spec browser… can you repro in IE10 which is fully supported?)


(Tom Piddock) #8

Replicated successfully in IE10.


(Tom Piddock) #9

Replicated in Chrome. Same symptoms, same steps.

Interestingly, Replicated in Firefox - however when disabling the javascript it no longer becomes an issue and the bug does not occur. This made me investigate a bit.

When attempting to replicate the effect sometimes the action of middle clicking one link opens both of them (note: not a duplicate of the single link, instead middle click would open google1 and google2 instead of just google1).


(Neil Lalonde) #10

The middle mouse button problems are caused by this line in our click tracking js:

$link.attr('href', null);

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/click_track.js#L29

Windows browsers don’t recognize an <a> tag without an href to be a link. So middle mouse click on it is like a click on empty space, which brings up the scrolling widget thing.

If I comment out that line, then I don’t get the scrolling thing anymore. But then there are other problems. Two windows open from one click (left click, right click, and middle click), and chrome’s popup blocker kicks in for one of them.

There’s history to that click tracking code. Other problems and browser quirks have been worked around already.

I don’t know what the solution is… besides getting used to ctrl-click to open in new tab instead of middle click?


(Jeff Atwood) #11

Can you see if this is still an issue after the Firefox middle click fix?


(Neil Lalonde) #12

I can’t reproduce this problem anymore. It’s fixed!


(Neil Lalonde) #13

This topic was automatically closed after 12 hours. New replies are no longer allowed.