Closed Bug 1712021 Opened 3 years ago Closed 5 months ago

Mouse shortcuts don't work when dispatching a new MouseEvent

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

Firefox 88
Desktop
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 1739929

People

(Reporter: ryanjmack21, Unassigned)

Details

(Keywords: parity-chrome, parity-safari)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36

Steps to reproduce:

Not all clickable areas in our UI can be expressed as <a href> - we have complex dom elements with custom click handlers, such as table rows.

This is a contrived example of how we work around this limitation - https://jsfiddle.net/yb5me94t/ - It works as expected in Chrome v90 and Safari v14, but not Firefox v88.

Normal click works in FF in the linked JS Fiddle, but once you use any of the mouse shortcuts the event fails to do anything. I was able to reproduce in a production grade React app, on codepen.io and also on JSFiddle - the browser is definitely the issue.

Actual results:

Normal click works, any of the following mouse shortcuts do no work:

Shift + Left-click Open a link in a new window
Ctrl/Cmd + Left-click Open a link in a new tab in the background
Ctrl/Cmd + Shift + Left-click Open a link in a new tab and switch to the new tab

Expected results:

Mouse shortcuts should work when dispatching a new MouseEvent

The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

Another simple example - https://jsfiddle.net/L1hwxc4f/

Was able to reproduce the issue in FF v70 as well.

https://jsfiddle.net/d_toybox/kqgdpfcv/

Hmm, the event is initialized as expected. shiftKey, ctrlKey and metaKey are derived from the trusted click event. But perhaps, the modified link click is ignored by our content click event handler even if it's during the user's input.

Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → Desktop

It's here:
https://searchfox.org/mozilla-central/rev/6e630edb09c3ab06d0103665b16c9ea7dce782c5/browser/actors/ClickHandlerChild.jsm#29,34

And even if it's not during user input, the synthesized event is accepted.
https://jsfiddle.net/d_toybox/kqgdpfcv/1/

So, we could relax about the link click handling.

Severity: -- → S3
Priority: -- → P3

:masayuki, has this maybe been fixed? The testcase in comment #4 seems to work for me as it does in Chrome and Safari now.

Edit: yes, mozregression gives this regression range for the fix: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=bf638341288eacbfd43ac6d8d3080e011ff1e8fb&tochange=853874dee29b2a068a74b2a550151afaffd939ce

This lead me to bug 1739929, fixed quite long ago now.

Flags: needinfo?(masayuki)
Status: NEW → RESOLVED
Closed: 5 months ago
Duplicate of bug: 1739929
Flags: needinfo?(masayuki)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.