This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17840 - menuitem click and menu show events do not indicate what element triggered these events
Summary: menuitem click and menu show events do not indicate what element triggered th...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 16816
  Show dependency treegraph
 
Reported: 2012-07-18 07:00 UTC by contributor
Modified: 2013-04-03 22:31 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:00:33 UTC
This was was cloned from bug 16816 as part of operation convergence.
Originally filed: 2012-04-21 20:56:00 +0000
Original reporter: bugzilla.w3c@signpostmarv.name

================================================================================
 #0   bugzilla.w3c@signpostmarv.name                  2012-04-21 20:56:35 +0000 
--------------------------------------------------------------------------------
I'm noticing that the properties provided via the click event on a menuitem element and the show event on a menu element do not indicate what element was interacted with in order to trigger a context menu to be used. Consequently, one has to use a workaround by adding a listener to the contextmenu event- this does not appear to the most graceful solution.

For an implementation of this workaround, see http://pastebin.com/7kS8tu2W

My preferred solution would be a property on both events that indicates the element that triggered the context menu to appear.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-27 04:00:58 UTC
Hm, yeah.

I guess I should set relatedTarget on the 'click' event of events fired on elements in a context menu to point to the element that had the contextmenu attribute. Would that work?
Comment 2 bugzilla.w3c 2012-09-27 20:32:15 UTC
That would likely work, yes.

Unsure if there are similar events that would benefit from such a property though.
Comment 3 Ian 'Hixie' Hickson 2012-12-29 16:48:35 UTC
I guess we need a new event type interface that has relatedTarget, since contextmenu and show are sometimes simple events, not mouse events.
Comment 5 contributor 2013-04-03 20:23:40 UTC
Checked in as WHATWG revision r7791.
Check-in comment: Add a .relatedTarget attribute on 'show' events for <menu> elements.
http://html5.org/tools/web-apps-tracker?from=7790&to=7791
Comment 6 contributor 2013-04-03 22:31:19 UTC
Checked in as WHATWG revision r7792.
Check-in comment: Set the .relatedTarget attribute on 'click' events for <menuitem> elements (and their master commands) properly.
http://html5.org/tools/web-apps-tracker?from=7791&to=7792