Open
Bug 314314
Opened 20 years ago
Updated 3 years ago
onContextMenu event doesn't send mouse coordinates if raised using keyboard
Categories
(Core :: DOM: Events, enhancement, P5)
Tracking
()
NEW
People
(Reporter: amla70, Unassigned)
Details
(Keywords: testcase)
Attachments
(1 file)
787 bytes,
text/html
|
Details |
If a script tries to capture the onContextMenu event in order to supply a custom context menu (provided that the user allows to replace the context menu of course), the handler works fine unless it is raised using the contextMenu key or Shift+F10.
The problem is that the event doesn't provide the current coordinates of the mouse and it always says that the event takes place at (0x0) of the focused element.
On the other side IE 6.0.2900 provides the coordinates of the mouse so it is possible to always place the context menu wherever the mouse is, and if the designer of the page wants to place it at (0x0) of the target element it's just a matter of checking boundaries before showing the new context menu.
Testcase following.
Reporter | ||
Comment 1•20 years ago
|
||
The test case captures the event and shows in a textarea the X and Y coordinates of the event.
Another difference between IE and Gecko is that in IE the button is 0 and in Gecko is 65535.
In both browsers the native context menu appears at 0x0 of the current element. But in IE as I said the clientX and clientY provide the current mouse position.
(the comments about the behaviour are related just to using the keyboard everything is fine using the mouse)
Comment 2•20 years ago
|
||
This is WORKSFORME with current trunk build.
Comment 3•19 years ago
|
||
I think I see what Alfonso is saying.
If I'm not focused inside the textbox (that is, I've just visited the page), I can hit my context menu key, and the context menu opens at 0,0. This is where the HTML element opens at, not where the mouse is.
The event is triggered by a keystroke, not a mouse click.
Reference http://lxr.mozilla.org/seamonkey/source/content/events/src/nsEventListenerManager.cpp#1973 . This is done deliberately.
I'm marking this bug as NEW, but I think it really might be a WONTFIX.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•16 years ago
|
Assignee: events → nobody
QA Contact: ian → events
Comment 4•14 years ago
|
||
http://dev.w3.org/html5/spec/interactive-elements.html#context-menus
http://dev.w3.org/html5/spec/webappapis.html#fire-a-synthetic-mouse-event
"screenX, screenY, clientX, clientY, and button attributes initialized to 0"
So, it seems that we should return 0 instead of the focused element position?
Comment 5•14 years ago
|
||
HTML spec may or may not be right. Better to test what other browsers do.
I kind of like how contextmenu event works atm (well, tested only on Linux).
Page seems to get the coordinates where the menu is opened.
Comment 6•7 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•