Closed Bug 326851 Opened 19 years ago Closed 13 years ago

No click fired when mousedown in child element and mouseup in parent element

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: martijn.martijn, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(3 files, 2 obsolete files)

See upcoming testcase.

To reproduce:
- Mousedown on the yellow block, hold down your mouse button
- Move the mouse into the green block
- Release mouse button

I get no 'click' alert in Mozilla.
Should I get a 'click' alert or not? (IE6 generates a 'click' alert)
Attached file testcase
Opera9tp2 shows no click too. (Same as firefox)
This is what dom level 2 has to say:
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mouseevents-h3
"
click
    The click event occurs when the pointing device button is clicked over an element. A click is defined as a mousedown and mouseup over the same screen location. The sequence of these events is:
"
Not very clear to me what that means in this situation.

Imho, IE6 seems to make more sense to me.
Blocks: 324396
Note that this might be more of an "event handling" issue (as in, the fix will be in the ESM, not in DOM event code).
This is not a bug.

According to SVG specifications you should never get a Click event if you have moved the mouse between mousedown and mouseup.
That on the other hand is a bug. (Mozilla does sometimes generate clicks when the mouse has moved between mousedown and mouseup) See: https://bugzilla.mozilla.org/show_bug.cgi?id=319347

I don't know why you are getting click events in IE6 using your testcase. If you try the testcase in bug# 319347 you will see that IE6 does not generate click events if the mouse has moved between mousedown and mouseup. That is the correct behaviour.

If you want an event when the mouse button is released in your testcase, you should use the "mouseup" event, not the click event.
(In reply to comment #5)
> According to SVG specifications you should never get a Click event if you have
> moved the mouse between mousedown and mouseup.

Er, what has SVG do with this ?
> click
>     The click event occurs when the pointing device button is clicked over an
> element. A click is defined as a mousedown and mouseup over the same screen
> location. The sequence of these events is:
> "

I believe the mousedown and the mouseup event should fire over the *same* element in order to be considered a click event. Otherwise, it's not a true click on a single element but rather mouse-dragging or text selection or selection (highlighting). My 2 cents.
Attached file testcase2
Here the yellow block disappears on mousedown.
Opera9 and IE7 generate a click event in this case,
but in Opera9, if you move the mouse after mousedown and before you mouseup, the click alert isn't fired.
Assignee: events → nobody
QA Contact: ian → events
click event is attached to the outer div, the inner div has an active style that repositions it slightly. Clicking near the border of the inner div will be lost because the mousedown div is different than the mouseup div.
click event is attached to the outer div, the inner div has an active style that repositions it slightly. Clicking near the border of the inner div will be lost because the mousedown div is different than the mouseup div.
Attachment #540854 - Attachment is obsolete: true
click event is attached to the outer div, the inner div has an active style that repositions it slightly. Clicking near the border of the inner div will be lost because the mousedown div is different than the mouseup div.
Attachment #540856 - Attachment is obsolete: true
Based on DOM 3 Events this is invalid.
mousedown and mouseup must happen on the same element.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
This was asked on http://stackoverflow.com/q/34029785/1026, so I researched it a bit.

The current location of the spec seems to be: https://w3c.github.io/uievents/#event-type-click
from my reading of it, it implies that our current behaviour is the expected one, but I can't see where in the normative text it says that.

IE and Chrome currently fire a 'click' (on the common ancestor?), but both have bugs filed about this:

Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=484655
IE bug: https://connect.microsoft.com/IE/feedback/details/809003/unexpected-click-event-triggered-when-the-elements-below-cursor-at-mousedown-and-mouseup-events-are-different
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: