W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2013

Re: [uievents] Middle click

From: Ojan Vafai <ojan@chromium.org>
Date: Thu, 12 Sep 2013 17:59:02 -0700
Message-ID: <CANMdWTsSL6eGrKkzMPbqcxXdnt2LvEobNuFbgkGqEMZANYCYLg@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: www-dom <www-dom@w3.org>
It seems to me that not firing click events for middle/right clicks is the
simplest path towards interoperability that is backwards-compatible.


On Tue, Aug 27, 2013 at 6:44 AM, Simon Pieters <simonp@opera.com> wrote:

> On Tue, 27 Aug 2013 13:38:30 +0200, Simon Pieters <simonp@opera.com>
> wrote:
>
>  What should happen when the user clicks the middle mouse button?
>>
>> The current situation is as follows:
>>
>> Gecko always fires a click event on the document that bubbles and has as
>> target the element being clicked.
>>
>> IE doesn't fire a click event if the target is a link, but does fire it
>> if another element is clicked even if it's a descendant of a link.
>>
>> Blink/WebKit always fire a click event on the element being clicked.
>>
>> Presto never fires a click event for middle mouse.
>>
>> There even might not be fired in some browsers if the click starts
>> panning mode or some such.
>>
>> The problem with Blink/WebKit's approach is that sites do something on
>> click which doesn't make sense to do if the user clicks the link with the
>> middle mouse button which should open the link in a new tab. Both actions
>> happen which is not what the user expects.
>>
>> IE's approach maybe works most of the time but fails when a link contains
>> elements, so seems suboptimal.
>>
>> Gecko's approach probably works pretty well but is a bit magic and would
>> still fail on sites that put the listener on document or window but still
>> assume the left button is being clicked.
>>
>> Presto's approach works always AFAICT.
>>
>> All browsers fire mousedown and mouseup as normal for middle mouse
>> button, so e.g. games or mapping apps that really want to use the middle
>> mouse button separately can still listen for it with these events.
>>
>> Since click event for middle mouse button is already unreliable, it seems
>> that sites can't depend on it being fired if they want to use the middle
>> mouse button. As such it seems to me that the best approach is what Presto
>> does, to never fire click for the middle mouse button.
>>
>> Blink bug for this issue is https://code.google.com/p/**
>> chromium/issues/detail?id=255<https://code.google.com/p/chromium/issues/detail?id=255>
>>
>
> Another option could be to mint a new event for middle click. The right
> mouse button already has a dedicated event for it (contextmenu).
>
>
> --
> Simon Pieters
> Opera Software
>
>
Received on Friday, 13 September 2013 00:59:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:03 UTC