Closed Bug 1090906 Opened 7 years ago Closed 7 years ago

Inaccessible context menu is presented with right-click when in Pointer lock mode.

Categories

(Core :: DOM: Events, defect)

33 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: jujjyl, Assigned: smaug)

Details

Attachments

(1 file)

STR:

1. Visit https://dl.dropboxusercontent.com/u/40949268/dump/pointer-lock-demo-fullscreen/index.html
2. Click on the canvas, accept the fullscreen and pointerlock requests.
3. Press the right mouse button.

Observed:

A context menu is presented, but the user has no way to access it since there is no mouse cursor: https://dl.dropboxusercontent.com/u/40949268/Bugs/pointerlock_rightclick.png

Expected:

The context menu should not appear on right-click.
hmm, I wonder what the behavior should be.
I guess the context menu could be disabled, or even should be.
I don't think there's other way than to disable the context menu. This is because when the user right-clicks, there's no way to choose which element the context menu should apply to. Dropping the fullscreen mode, one can also repro it here: https://dl.dropboxusercontent.com/u/40949268/dump/pointer-lock-demo/index.html . It seems that the context menu is applied to the element that's at the center of the screen, and if one resizes the page to very small size before going to pointer lock mode, so that the canvas is not at the center of the page, then the context menu that pops up applies to the page background rather than the canvas, which makes no sense.
But we still do want right clicks I assume. Just don't show the contextmenu.
Yeah, definitely - applications will want to process the right clicks in a way that they see applicable, so the right click events should flow, just that a context menu would never show up even if the JS code did not .preventdefault() the events away.
Ok, let's not dispatch contextmenu event nor show the context menu.
Assignee: nobody → bugs
https://tbpl.mozilla.org/?tree=Try&rev=8215ff4245d7

Returning error code from EventStateManager::PreHandleEvent prevents
DOM dispatch and PostHandleEvent call.

CreateClickHoldTimer/FireContextClick cases are need for the case when we
have click_and_hold_activates_context_menu active.

Test is rather minimal.
(and we have pointerlock tests disabled on linux, but I enabled them locally)
Attachment #8513750 - Flags: review?(masayuki)
https://hg.mozilla.org/mozilla-central/rev/b0b71ab4cd59
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Great work, thanks!
You need to log in before you can comment on or make changes to this bug.