Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
Moderator: trava90
Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.
Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.
Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
- Clear any current output
- Navigate or refresh the page in question
- Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
If you right-click the result area on this JSFiddle, when you release right-click "a" is displayed. This is not the case on other browsers, where only a left click triggers the click event. https://w3c.github.io/uievents/#event-type-click specifies that the click event is only meant to be fired by clicking the primary pointer button or simulating such an action.
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
Also occurs with the middle mouse button
-
- Keeps coming back
- Posts: 940
- Joined: 2021-01-26, 11:18
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
It applies for window, not a button element. Did you try https://jsfiddle.net/wkcr5p4e/?
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
If you switch the code in the second link you sent to document.addEventListener("click", myFunction); or window.addEventListener("click", myFunction); instead of element.addEventListener("click", myFunction); it occurs.
-
- Keeps coming back
- Posts: 940
- Joined: 2021-01-26, 11:18
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
That link is slightly different. The latest Firefox version clicks the hovered over option when releasing right-click on the browser's context menu, yes. However, that Firefox version does not actually fire a click event to the document or window at that time. Only Pale Moon does that. And firing the click event when using the middle or right mouse button definitely contradicts the part of the w3c spec that says "The click event should only be fired for the primary pointer button (i.e., when button value is 0, buttons value is 1). Secondary buttons (like the middle or right button on a standard mouse) MUST NOT fire click events."
-
- Pale Moon guru
- Posts: 35652
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
I confirm that we're doing this differently than Google Chrome or the latest Firefox. That said this is not a regression as far as I can tell.
The issue is that you're attaching the click event to the window, way up the hierarchy and not on a trusted target for receiving these events (which are meant to be Elements, not the document or window, see also the table in the W3C spec you're referring to). You should never do that.
It doesn't seem like even Mozilla themselves have a clear record of when this changed, it may need a mozregression to find out.
The issue is that you're attaching the click event to the window, way up the hierarchy and not on a trusted target for receiving these events (which are meant to be Elements, not the document or window, see also the table in the W3C spec you're referring to). You should never do that.
It doesn't seem like even Mozilla themselves have a clear record of when this changed, it may need a mozregression to find out.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
Hmm, interesting, you're right that those are not Trusted Targets, but I've seen so many people all over the web do document.addEventListener("click") or window.addEventListener("click") that I never would have thought as much.
I suppose the simplest workaround, which would also match the spec, would be to use document.documentElement.
I suppose the simplest workaround, which would also match the spec, would be to use document.documentElement.
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
It's so prevalent it even appears on https://www.w3schools.com/jsref/met_doc ... stener.asp
-
- Apollo supporter
- Posts: 41
- Joined: 2023-08-02, 19:42
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
According to https://developer.mozilla.org/en-US/doc ... patibility, Firefox 68 was when this behavior changed.
See https://developer.mozilla.org/en-US/doc ... dom_events
Bugzilla ticket https://bugzilla.mozilla.org/show_bug.cgi?id=1379466
See https://developer.mozilla.org/en-US/doc ... dom_events
Bugzilla ticket https://bugzilla.mozilla.org/show_bug.cgi?id=1379466
-
- Pale Moon guru
- Posts: 35652
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: Only on Pale Moon, releasing right-click fires click event on https://jsfiddle.net/wkcr5p4e/
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite