I'm not sure how the code is actually written, but it seems that votes are registered as soon as I click on the up/down arrow, and not when the mouse button is released.

This causes problems for me as I like to highlight text when reading it. I'll often accidentally vote something up without actually meaning to. The usual behaviour of most UIs is that if you remove your mouse from the element/button before releasing the click, then the click doesn't have any effect.

However, this is not the case on Stack Exchange sites. This is acceptable on questions and answers, as I can nullify the vote by clicking again. However on comments, it is impossible to nullify the vote.

Can this functionality be fixed, or allow an option to nullify comment votes the same as votes on questions and answers?

  • 8
    "Why are votes triggered OnMouseDown and not OnClick?" -- they aren't, and I cannot reproduce what you're describing. What browser are you using? – balpha Sep 18 '11 at 12:26
  • 1
    Using Firefox 6.02 on Windows XP. But I experience on all machines I've used mostly Firefox and Chrome. Click down on the up arrow, drag away from the arrow, when you release, the upvote will be triggered. Try it with this question, but click again to cancel out your vote please. Or try it on one of your own existing questions or answers, since you can't vote on it, it won't register, but it will display an error message, as if you had clicked on it. – Kibbee Sep 18 '11 at 12:50
  • status-norepro here on Safari/Mac. – tvanfosson Sep 18 '11 at 12:56
  • Not reproducible in Chromium 12/Ubuntu 11.04. Using Firefox 5 clicking the up-vote and dragging away triggers the upvote on mouse-release (even if the mouse is outside of the browser window...weird). – David Thomas Sep 18 '11 at 13:02
  • Okay, reproducing a similar issue (not quite what you're describing, but with a similar result) in Firefox. – balpha Sep 18 '11 at 13:02
  • Weird. It seems merely clicking and holding the button down doesn't submit the vote, but when you release it, the vote goes through no matter where your cursor is. – a cat Sep 18 '11 at 13:05

This is an age-old problem with Firefox; unfortunately, Mozilla seems to consider this to be by design.

Utterly unfixable on our side (at least with any reasonable amount of effort); sorry.

  • Perhaps this occurs because you register the click on a standard div or other element, sorry again not too sure of implementation specifics. Perhaps this could be fixed by making the upvote/downvote element an actual <input type="submit" ...> or by using the <button> element, maybe even use a <input type="image". You can style these element pretty extensively with CSS and should be able to get this to work the way you want to. For example, the "Add Comment" button I see beside this comment box does not exhibit this problem. – Kibbee Sep 18 '11 at 16:35
  • 3
    Believe it or not, I have researched this. That's where the links in my post come from. Firefox captures the mouse context when starting to drag in an element that's overflow:hidden, and it doesn't matter at all what kind of element it is. There is no "perhaps". And to work around this, we'd have to restyle all Stack Exchange sites that exist, or invent our own mouse event handling. For a browser issue that doesn't really impact actual functionality, that kind of effort is a no-go. – balpha Sep 18 '11 at 17:39
  • Ok, thanks for the info. Alternatively, since you can't fix firefox, can you add click to nullify votes on comments so they work the same as questions and answers. I think that would be do-able. I would be good for this use case, as well as any other case where the user clicked upvote on a comment, and didn't mean to. – Kibbee Sep 19 '11 at 0:19
  • 3

I have fixed it with this GreaseMonkey script. I simply removed the overflow X/Y hidden and changed it to visible. I seems to remove the click and drag bug. It also doesn't appear to change the look of the site at all. The script as I have written it includes itself for all *.stackexchange.com, superuser.com, serverfault.com, and stackoverflow.com, as well as all the metas for the mentioned sites. I only tested that it works for bicycles.stackexchange.com, superuser.com, serverfault.com, stackoverflow.com, and the associated metas. Here is the script.

// ==UserScript==
// @name           fix vote accident click
// @namespace      Kibbee
// @description    fixes accidental vote clicks
// @include        http://stackoverflow.com/*
// @include        http://superuser.com/*
// @include        http://serverfault.com/*
// @include        http://*.stackexchange.com/*
// @include        http://meta.stackoverflow.com/*
// @include        http://meta.superuser.com/*
// @include        http://meta.serverfault.com/*
// ==/UserScript==

function FixClick(XPathToHide)
        var allElems, thisElem;

        allElems = document.evaluate(
        for (var i = 0; i < allElems.snapshotLength; i++) {
                thisElem = allElems.snapshotItem(i);
                thisElem.style.overflowX = 'visible';
                thisElem.style.overflowY = 'visible';

FixClick("//a[@class='comment-up comment-up-off']");

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .