Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

don't mark links visited on right click or on drag #1224

Closed
wants to merge 3 commits into from

Conversation

honestbleeps
Copy link
Contributor

a common use case, for example, is right click / open in incognito. it's not good to add links to history when that's the user's intent, so this function shouldn't be run on right clicks.

confession: this is a blind-ish PR I whipped up real fast without testing because my VM is dead. If someone with a running VM could test this, I'd appreciate it. Otherwise, I'll try to get it running again soon.

I do think it should work though. Pretty simple change.

@spladug
Copy link
Contributor

spladug commented Dec 28, 2014

Thanks for the patch!

This is related to #79.

@honestbleeps
Copy link
Contributor Author

apologies for not searching the issues, I figured since it'd been going on so long it probably wasn't reported! Good find :)

@spladug
Copy link
Contributor

spladug commented Dec 28, 2014

Oh no, not your fault. I just wanted to put a link here so we remember to close it.

@JordanMilne
Copy link
Contributor

Hmm, looks like some of the issues in #78 wouldn't be addressed by this (dragging the link around the page with either the middle or left mouse button is counted as a visit.) Is the click event more appropriate than mousedown here?

TBH I'm surprised that there isn't a standard DOM event for when navigation is caused by interacting with an anchor...

@honestbleeps
Copy link
Contributor Author

the click event might be more appropriate, yes. I had assumed there was some reason you'd used mousedown - perhaps you'd found that the event was sometimes lost with timing due to the few MS difference. Detecting a click prior to immediate navigation away from the site is a tricky one at times depending on the browser (although maybe with newer browsers that has become less problematic, I'm not sure)

Do you know why mousedown was chosen, by chance?

certainly some logic could be put in to my patch to handle the drag scenario but that wasn't on my radar at the time I wrote this up. I feel like that's a much tinier percentage use case that might be addressed in a second round, but if you'd like me to take a look at it I can!

@JordanMilne
Copy link
Contributor

I don't know if there was any reason for using mousedown, maybe just for parity with the keydown event? Draging shouldn't trigger the click event (at least it doesn't in Gecko) so changing the mousedown to click should cover it

@honestbleeps
Copy link
Contributor Author

okay, I've changed it to click!

@JordanMilne
Copy link
Contributor

LGTM, but I'll defer to one of the JS folks 🐟

@honestbleeps
Copy link
Contributor Author

my above confession still stands, haven't had time to recreate a VM yet, so if someone could give it a sanity test real fast that'd be appreciated.

@honestbleeps honestbleeps changed the title don't mark links visited on right click don't mark links visited on right click or on drag Dec 30, 2014
@spladug
Copy link
Contributor

spladug commented Dec 31, 2014

👓 @ajacksified @madbook @dwick (the frontend crew)

Note, a lot of people are on vacation right now so I doubt there'll be much movement until next week. Sorry :(

@@ -15,8 +15,8 @@ r.visited = {
},

onVisit: function(ev) {
if (ev.type == 'keydown' && ev.which != 13) {
// only handle enter key presses
if ((ev.type == 'keydown' && ev.which != 13) || (ev.which === 3)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: (ev.which === 3) doesn't require braces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, removed

@madbook
Copy link
Contributor

madbook commented Jan 6, 2015

looks good to me 🐟

@honestbleeps
Copy link
Contributor Author

anything else needed, @ajacksified @dwick or @madbook ? I know it's tiny, but I'd love to get my first (accepted) reddit PR in :-)

@dwick
Copy link
Contributor

dwick commented Jan 15, 2015

Hey @honestbleeps! Thanks for the contribution, it's been rebased and merged as ad42be6. 🏆 incoming!

@dwick dwick closed this Jan 15, 2015
@honestbleeps
Copy link
Contributor Author

:-D thanks! very exciting

@dwick
Copy link
Contributor

dwick commented Jan 15, 2015

Can you email me your reddit username? wick@reddit.com

@umbrae
Copy link
Contributor

umbrae commented Jan 15, 2015

@dwick It's honestbleeps. :)

@TechNickAI
Copy link

Great work @honestbleeps - have a high five on me with @changetip

@changetip
Copy link

Hi @honestbleeps, I've delivered a Bitcoin tip worth a high five (24,011 bits/$5.00) from @gorillamania to your ChangeTip wallet.

Learn about ChangeTip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
8 participants