Closed
Bug 217560
Opened 21 years ago
Closed 21 years ago
Left/Right clicks undiscriminated for double-clicks (ondblclick event)
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha1
People
(Reporter: jruderman, Assigned: emaijala+moz)
References
Details
Attachments
(2 files)
63 bytes,
text/html
|
Details | |
4.03 KB,
patch
|
deanis74
:
review+
roc
:
superreview+
asa
:
approval1.8a2+
|
Details | Diff | Splinter Review |
The following all trigger ondblclick: Left Left Left Right Right Left Right Right Only the first should trigger ondblclick. This is like bug 86468, except that it's not fixed. I'm going to attach an HTML testcase, even though this mostly affects browser chrome.
Reporter | ||
Comment 1•21 years ago
|
||
Reporter | ||
Comment 2•21 years ago
|
||
I just hit another manifestation of this bug, this time in Mozilla Firebird. 1. Start with only one tab open. 2. Middle-click any link at the top of the viewport and near the middle. Result: a new background tab opens, and the tab bar appears. (good) 3. Quickly left-click on the new tab. Result: a third tab opens. (bad)
Reporter | ||
Comment 3•21 years ago
|
||
*** Bug 240658 has been marked as a duplicate of this bug. ***
Comment 4•21 years ago
|
||
Don't forget the middle mouse button, which adds: Middle Left Middle Right Right Middle Left Middle (although autoscroll seems to block this in html and several other places.) -[Unknown]
I run into this bug all the time in the Firefox download manager. When I first select a downloaded file, then right click to pop up the context menu, it is interpreted as a doubleclick and the file is being opened. Very frequently this is an executable file. Fortunately the program pops up a warning dialog, but still there is some danger of accidentally starting an executable to it if you ask me. ~Grauw
Updated•21 years ago
|
Assignee: saari → firefox
Target Milestone: --- → mozilla1.8alpha1
Comment 6•21 years ago
|
||
*** Bug 244692 has been marked as a duplicate of this bug. ***
Reporter | ||
Comment 7•21 years ago
|
||
*** Bug 246279 has been marked as a duplicate of this bug. ***
Comment 8•21 years ago
|
||
*** Bug 185259 has been marked as a duplicate of this bug. ***
Comment 9•21 years ago
|
||
*** Bug 211927 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 11•21 years ago
|
||
This is a patch to make the double-click work only if it's the same button being clicked (plus some comment fixes). It does not prevent double-clicking with the middle or right button (I suggest someone file another bug for that if it's really necessary).
Assignee | ||
Comment 12•21 years ago
|
||
Actually, the right (or middle) double-click could be handled in bug 211177.
Assignee | ||
Updated•21 years ago
|
Attachment #152294 -
Flags: review?(dean_tessman)
Comment 13•21 years ago
|
||
Comment on attachment 152294 [details] [diff] [review] Patch v1 I agree with this approach. We shouldn't be restricting which button can trigger a double-click. This means re-opening most of the bugs that were duped against this one to properly check for, in mose cases, event.button == 0. One question, is this what the other platforms do as well?
Attachment #152294 -
Flags: review?(dean_tessman) → review+
Assignee | ||
Comment 14•21 years ago
|
||
Comment on attachment 152294 [details] [diff] [review] Patch v1 I think that at least on GTK the toolkit provides support for triple-clicks, so there is no need for additional code. I don't know about the others.
Attachment #152294 -
Flags: superreview?(roc)
Comment 15•21 years ago
|
||
Yeah, I looked through the code and each platform handles clicks very differently. From the GTK2 code, it already works like this on that platform.
Reporter | ||
Comment 16•21 years ago
|
||
(In reply to comment #13) > (From update of attachment 152294 [details] [diff] [review]) > I agree with this approach. We shouldn't be restricting which button can > trigger a double-click. This means re-opening most of the bugs that were duped > against this one to properly check for, in mose cases, event.button == 0. If it isn't restricted here, there has to be a check for (event.button == 0) EVERYWHERE the ondblclick event is used in Mozilla and Firefox UI. That's silly, unless you have a good reason that a double right-click should trigger ondblclick.
Comment 17•21 years ago
|
||
(In reply to comment #16) > If it isn't restricted here, there has to be a check for (event.button == 0) > EVERYWHERE the ondblclick event is used in Mozilla and Firefox UI. That's > silly, unless you have a good reason that a double right-click should trigger > ondblclick. I couldn't find anything in the documentation on w3c.org that restricted ondblclick to only left clicks. As far as I can tell, it's open to come from any mouse button, exactly as onclick is. This is toolkit code. The toolkit shouldn't impose restrictions like this. (I'm open to corrections if I'm wrong about the documentation.)
Assignee | ||
Comment 18•21 years ago
|
||
Even if we want to restrict ondblclick to the left button (actually, should that be the "main" button or something to account for left-handed users?), it should be done wherever the ondblclick event is fired (or thereabouts) and not in nsWindow.cpp.
Reporter | ||
Comment 19•21 years ago
|
||
ondblclick does not appear in DOM 2 Events or in DOM 3 Events. It only appears in http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3, which doesn't mention mouse buttons. Internet Explorer only triggers ondblclick for double left-clicks. I'd rather go with common sense and compatibility with Internet Explorer than a strict reading of an old specification. http://www.w3.org/TR/DOM-Level-3-Events/events.html includes an example that suggests that they don't plan to add ondblclick, and that Internet Explorer is wrong to skip onclick events for the second click of a double click.
Did you forget to include nsWindow.h or something like that in the patch? I don't see a declaration for gLastMouseButton
Assignee | ||
Comment 21•21 years ago
|
||
It's in the third hunk among the other statics (they're all declared in nsWindow.cpp).
Comment on attachment 152294 [details] [diff] [review] Patch v1 oh oops! I think you should check this in while you continue discussing whether to check for the left button.
Attachment #152294 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Comment 23•21 years ago
|
||
Comment on attachment 152294 [details] [diff] [review] Patch v1 Requesting approval to check in this quite simple fix.
Attachment #152294 -
Flags: approval1.8a2?
Comment 24•21 years ago
|
||
Comment on attachment 152294 [details] [diff] [review] Patch v1 a=asa (on behalf of drivers) for checkin to 1.8a2
Attachment #152294 -
Flags: approval1.8a2? → approval1.8a2+
Assignee | ||
Comment 25•21 years ago
|
||
Ok, the first patch is now checked in, so clicking two separate buttons doesn't fire double-click events anymore. Now we should discuss if (and where) we want to allow double-clicks for the first button only. Reportedly at least on gtk2 you can get double-clicks also with the right button, so I think now gtk2 and win32 work in the same way. To keep the platform parity I would keep windows/nsWindow.cpp as it is. Instead, if double-clicks should be fired for only the main button, other buttons should be filtered out somewhere around the place where the actual js event is fired. How about a new bug for that, if it's deemed necessary?
Assignee | ||
Comment 26•21 years ago
|
||
No comments -> marking fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 27•20 years ago
|
||
In the latest Firefox branch nightly (2004-07-28) I still see the behaviour I described in comment #5... In other words, it doesn't work (everywhere)? ~Grauw
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•