Closed Bug 569071 Opened 15 years ago Closed 15 years ago

Click propagation with contextmenu problem

Categories

(Core :: DOM: Events, defect)

x86
Windows 7
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: bugzilla33, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100523 Firefox/3.6.4

contextmenu should prevent to 'click' event fire

Reproducible: Always

Steps to Reproduce:
1. open URL or attachment
2 [review]. click red area
Actual Results:  
event fires

Expected Results:  
no event fires

explorer, safari, chrome, opera, konqueror have not this problem
Attached file testcase
confirmed with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a5pre) Gecko/20100529 Minefield/3.7a5pre ID:20100529040313
Keywords: testcase
> contextmenu should prevent to 'click' event fire

Why?  I don't think it should, and neither does the DOM spec...
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
>> contextmenu should prevent to 'click' event fire
> Why?  I don't think it should, and neither does the DOM spec...
Well another problem is that the click events get propagated upwards, but is not fired on the element itself. The click event is fired anyway whether the contextmenu event is cancelled or not, hence there is no easy way for to cancel it using javascript.
I've also explained this in the duplicate I've submitted: https://bugzilla.mozilla.org/show_bug.cgi?id=913910
@Boris_Zbarsky: Can you please take another look at this? This bug affects javascript development, and there's no obvious way to go around it.
Er... how so?  Click events tell you which button was clicked.  So if you want to only respond to left clicks, you can.
It's working quite well if I want to respond to left/right clicks, but the trouble happens when I want to stop the propagation of the click event upwards. I cannot do this, as calling stopPropagation() on the event (any of click, contextmenu, mousedown, mouseup) does not work - the event bubbles up as a click event instead.
The event is dispatch directly on the document for right clicks.  Is that what you're running into?
Attached file Demonstration of issue
I'm not entirely sure what you're saying, but I've uploaded a test case.
Attachment #806275 - Attachment mime type: text/plain → text/html
Sorry I have to double-post, don't see an edit button: by right-clicking the link, I see no way of blocking the detection of the right click event on the document.
The right-click click event fires on document, not on the link.
(Not per any specification, but there is no specification which defines how right click should work and all the browsers do it differently.)
So, you could for example add capturing event listener on document and call stopPropagation() there.
Thanks, I understand now, my mistake.
This might be a Bugzilla faux pas, but I would like to revisit this issue. I think it is reasonable to fire the click event, but what is the logic behind not letting the event pass through the originating element?
IMO I think that the event should pass through the originating element and behave similarly to a click event. A lot of other browsers handle it like this, I just put the stopPropogation() out there as a usage example.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: