Selecting a link results in it being opened

(Vikhyat Korrapati) #1

Try it out on the following line, if you start selecting the text, proceed to select part of the link and release the mouse button the link will be opened:

Some text followed by a link: Dinosaur Comics - April 16th, 2014 - awesome fun times!

This happens because the mouseup event is used for click-tracking here:

Is there any reason for using mouseup instead of click?

(cc @eviltrout)

Select text and release on a link will navigate to the link
(Luke S) #2

I can’t duplicate this. What browser are you using?

I tried:

  • Start outside of link. Got “Quote Reply”
  • Start at edge of link. Got “Quote Reply”
  • Start in middle of link. Can drag the link up and place it anywhere I want in my tab stream. Cool. =)

Win 7 Pro, Chrome Version 34.0.1847.116 m (latest stable)

(Vikhyat Korrapati) #3

OS X Firefox 30.0a2 and Chrome 34.

Was also reported here so I’m pretty sure it’s not just me.

(TechnoBear) #4

I can duplicate the issue on Firefox 28 and Chromium Version 33.0.1750.152 on Ubuntu 13.10.

(Kane York) #5

Yeah, this is happening. You need to start selecting from outside and drag your mouse inside the link.

(Lee Dohm) #6

Reproduced on OS X 10.9.2 Chrome 34 and Safari 7.

(Luke S) #7

Ohh… I thought that I had tried that… Yes, I see it too. At least it opens in a new tab…

(Sam Glover) #8

Happens for me even if I start selecting from outside the link. I don’t like this behavior.

(Michael Brown) #9

Confirmed. This was an old known bug, though I can’t remember if it was fixed or not - I can’t find the original thread.

Oh, wait, found it. :slight_smile:

(lid) #10

If anyone want to test this PR on different browsers and platform, more testing mean more likely it will get merged … or not :wink:

so far I was able to test with no issues on Windwos 8

  • Chrome 37
  • Firefox 32
  • IE10 (yikes)

You can quickly test the patch live in browser by copy-paste the following in console

window.temp = Discourse.ClickTrack.trackClick;
Discourse.ClickTrack.trackClick = function (e){
if (Discourse.Utilities.selectedText()!=="") return false;  //cancel click if triggered as part of selection.

Alternatively paste in the address bar the one liner below (note that some browser will strip the leading javascript: protocol on pasting, so add it manually.

javascript:window.temp=Discourse.ClickTrack.trackClick;Discourse.ClickTrack.trackClick=function(e){if(Discourse.Utilities.selectedText()!=="")return false;window.temp(e)}

(Sam Saffron) #11

This fix was not in the right spot … however, this one does the trick just fine

(Sam Saffron) #12