[Webkit-unassigned] [Bug 22382] Middle click fires onclick event
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Jun 13 16:05:03 PDT 2010
--- Comment #27 from Peter Kasting <pkasting at google.com> 2010-06-13 16:04:59 PST ---
(In reply to comment #25)
> > + // For clicks by the non-left mouse button, Gecko doesn't dispatch the
> > + // event to the DOM. However, we still want to call the default event
> > + // handler so that the we can open links in new tabs, etc.
> This comment is oblique. It says what Gecko does, and then segues into what we will do. The implication is that we plan to do the same thing Gecko does, but no reason is given. In my mind this raises others questions, like what W3C specifications say we should do and what other browsers do. Is this just a Gecko/WebKit alignment, or something we have noticed and are would like to have match among all web browsers?
The W3C spec (that I found) was extremely vague. Some of the Chromium folks looked at this a month or so ago. Here's some background discussion from that thread if you're interested.
<Ojan Vafai> Firing onclick on middle-click is clearly the more consistent behavior given that it has a property of which mouse button was clicked.. Hixie's suggestion to capture any navigations caused by middle-click and open them in a new tab instead seems like the ideal behavior. ... It's just a lot tricker.
<Peter Kasting> Capturing navigations and opening in a new tab seems hard in principle -- how do you know that a navigation was "caused by" this click in the presence of things like setTimeout()? Note that no one fires onclick for right-mouse-button. The argument I'd make is that "click" means "left-click", which lines up well with UI conventions that speak of "click to ____" and mean left-click. Middle- and right-click (and clicking the thumb buttons, etc.) are special kinds of clicks. If I were redoing things from the start I'd make all mouse buttons fire click and put in the button, or else I'd make each have a different event. Given what we have today, however, I'd say that click should be left-click, and if we really want, we should add a different event (or two) for middle click and/or right-click.
<Ojan Vafai> Ugh. It's more gross than I realized. I agree, just not firing click on middle-click is probably the only sane result.
Gecko: Click only fires for left-click.
WebKit: Click fires for left/middle-click, but not right-click.
Trident: Click fires for left/middle-click, but not right-click and not if the middle-click was on a link.
<Adam Barth> Joy. Do we want the Gecko behavior or the Trident behavior? The Gecko behavior seems to have lower entropy.
<Ojan Vafai> I prefer the gecko behavior.
1. WebKit more often gets sent down gecko codepaths than trident ones.
2. The Trident behavior is confusingly inconsistent. Avoiding it gives one less gotcha for web developers to learn.
<Evan Martin> I like the idea that "click" is something you do with your primary mouse button, whereas the other behaviors can be caught with onmousedown etc. (Really I prefer click to just be any mouse button, but that ship obviously sailed.)
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned