Open
Bug 1322876
Opened 8 years ago
Updated 3 months ago
"contextmenu" event has mozInputSource == MOZ_SOURCE_MOUSE even when hitting the context menu key on the keyboard
Categories
(Core :: DOM: Events, defect, P3)
Core
DOM: Events
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox53 | --- | affected |
People
(Reporter: squib, Unassigned)
Details
(Keywords: good-first-bug, Whiteboard: [domcore-bugbash-triaged])
Attachments
(2 files)
276 bytes,
text/html
|
Details | |
845 bytes,
patch
|
smaug
:
feedback+
|
Details | Diff | Splinter Review |
Per the bug title, the "contextmenu" event always claims to be from the mouse even when it's actually from the keyboard. That's because when the WidgetMouseEvent is created, the input source is never overridden: <https://dxr.mozilla.org/mozilla-central/rev/8103c612b79c2587ea4ca1b0a9f9f82db4b185b8/widget/MouseEvents.h#252>.
I have a test case and a patch that I'll upload shortly. This is my first (or maybe my second?) m-c bug, so I might get some of the review protocol wrong; if I do anything silly, just let me know!
Reporter | ||
Comment 1•8 years ago
|
||
Here's a simple test case that logs the input source in the error console. Currently, it always outputs 1 (mouse), even when the event comes from the keyboard.
Reporter | ||
Comment 2•8 years ago
|
||
Reporter | ||
Comment 3•8 years ago
|
||
Comment on attachment 8819081 [details] [diff] [review]
"contextmenu" event has mozInputSource == MOZ_SOURCE_MOUSE even when hitting the context menu key on the keyboard
Hopefully I flagged the right person for review and managed to upload this patch correctly. Where should I put tests for this? I'm not super-familiar with how m-c organizes its tests.
Attachment #8819081 -
Flags: feedback?(bugs)
Comment 4•8 years ago
|
||
Comment on attachment 8819081 [details] [diff] [review]
"contextmenu" event has mozInputSource == MOZ_SOURCE_MOUSE even when hitting the context menu key on the keyboard
It is not super important where to put tests. Possibly dom/events/test/*
You aren't setting button to any value when mContextMenuTrigger == eContextMenuKey.
Attachment #8819081 -
Flags: feedback?(bugs) → feedback+
Reporter | ||
Comment 5•8 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #4)
> It is not super important where to put tests. Possibly dom/events/test/*
Thanks! I'll look there and see if I can cargo-cult an existing test into something that checks this.
> You aren't setting button to any value when mContextMenuTrigger ==
> eContextMenuKey.
I was debating what to do here; It's automatically set to 0 in the WidgetMouseEventBase constructor (as is inputSource)[1], but it's theoretically possible that that would change in the future and then we'd have an uninitialized member. I suppose I'd want to either a) do what I'm doing now and rely on the base class to initialize its members, or b) set `button` *and* `inputSource` in both branches. I'm open to either; is there a general guideline I should follow here for Mozilla code?
[1] https://dxr.mozilla.org/mozilla-central/rev/8103c612b79c2587ea4ca1b0a9f9f82db4b185b8/widget/MouseEvents.h#94
Comment 6•8 years ago
|
||
The general guideline is something along the lines "whatever makes the code easiest to read and maintain, unless there are some performance or security related reasons to do otherwise".
So, in this case explicit initialization would be nice.
Updated•7 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Severity: normal → S3
Comment 7•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Assignee: jporterbugs → nobody
Status: ASSIGNED → NEW
Comment 8•3 months ago
|
||
Still valid, and the WIP in the attachment 8819081 [details] [diff] [review] is still pointing out the right direction.
Keywords: good-first-bug
Whiteboard: [domcore-bugbash-triaged]
You need to log in
before you can comment on or make changes to this bug.
Description
•