W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2013

Re: Firing click from middle/right mouse clicks WAS: Thanks for participating on the DOM3 Events Call

From: Daniel Bratell <bratell@opera.com>
Date: Thu, 24 Oct 2013 09:27:02 +0200
To: "Boris Zbarsky" <bzbarsky@mit.edu>, "Ojan Vafai" <ojan@chromium.org>
Cc: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.w5f6zcscrbppqq@cicero.linkoping.osa>
On Wed, 23 Oct 2013 22:34:52 +0200, Ojan Vafai <ojan@chromium.org> wrote:

> +Daniel who did the testing. Daniel, can you share your test case and  
> the results?
> On Wed, Oct 23, 2013 at 1:31 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> On 10/23/13 2:30 PM, Ojan Vafai wrote:
>>> FWIW, Blink is planning on moving to not firing click events for middle
>>> mouse clicks and already doesn't fire them for right clicks. As best I
>>> can tell, this matches Gecko and IE as well.
>> It certainly doesn't match Gecko.
>> Note that Gecko will fire non-left clicks directly on the document, so  
>> depending on how you wrote >>your testcase you may have not seen the  
>> events.
> That's right. I had forgotten about this. I'd only want to do this if we  
> were required to by web->compat.

The data is at: http://i.imgur.com/039VHDk.png (sorry for the poor format,  
it was the least complicated way of getting a document published at the  

Gecko does indeed fire a click event in most cases when the user presses  
and releases the middle button of the mouse, but according to the  
documentation in the Bugzilla bug, that was just to keep some internal  
functionality working. It is not a standard event since its target is the  
node you interact with, but it's not dispatched there but at the document  
(where it's unlikely to be seen).

The root problem is, how to make sure this click handler doesn't run when  
people use the middle button:

<a href="page.html" onclick="foo()">Middle click this link</a>

All browsers address that in different ways, but the absolutely simplest  
and cleanest solution is to not dispatch the event at all. It does mean  
that some browsers may have to rethink how they implement some UI  
functionality (in case that internally is hooked into the "click" event),  
and I'm looking at such a case in Chromium/Blink but that doesn't change  
my opinion that the world will be a better place if web pages never see  
any click event at all except for when the user uses the main mouse button.

Received on Thursday, 24 October 2013 07:30:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:21 UTC