"Menu" element missing from html_components?

help(html.Div) lists

  • contextMenu (optional): Defines the ID of a element which will serve as the element’s context menu.`

which sounds like a great feature, but “menu” does not exist in the html components library.

Is there currently a way to utilize the contextMenu (right-click) functionality?

Menu is a dash_html_components element. More (HTML) examples here: <menu>: The Menu element - HTML: HyperText Markup Language | MDN

I’m sure it’s obvious, but I must be missing something:

>>> html.Div 
<class 'Div'>
>>> html.Menu
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'dash_html_components' has no attribute 'Menu'

Nor is it listed here: https://github.com/plotly/dash-html-components/blob/master/scripts/data/elements.txt
or here: https://github.com/plotly/dash-html-components/blob/master/scripts/data/attributes.html

1 Like

@chriddyp Can you confirm that “Menu” is missing from dash-html-components?

I’ve run out of places to look, after finding that for '__version__': '0.11.0', pprint(html._components ) does not include ‘Menu’ as shown below.

>>> pprint(html._components )
[<class 'A'>,
 <class 'Abbr'>,
 <class 'Acronym'>,
 <class 'Address'>,
 <class 'Area'>,
 <class 'Article'>,
 <class 'Aside'>,
 <class 'Audio'>,
 <class 'B'>,
 <class 'Base'>,
 <class 'Basefont'>,
 <class 'Bdi'>,
 <class 'Bdo'>,
 <class 'Big'>,
 <class 'Blink'>,
 <class 'Blockquote'>,
 <class 'Br'>,
 <class 'Button'>,
 <class 'Canvas'>,
 <class 'Caption'>,
 <class 'Center'>,
 <class 'Cite'>,
 <class 'Code'>,
 <class 'Col'>,
 <class 'Colgroup'>,
 <class 'Command'>,
 <class 'Content'>,
 <class 'Data'>,
 <class 'Datalist'>,
 <class 'Dd'>,
 <class 'Del'>,
 <class 'Details'>,
 <class 'Dfn'>,
 <class 'Dialog'>,
 <class 'Div'>,
 <class 'Dl'>,
 <class 'Dt'>,
 <class 'Element'>,
 <class 'Em'>,
 <class 'Embed'>,
 <class 'Fieldset'>,
 <class 'Figcaption'>,
 <class 'Figure'>,
 <class 'Font'>,
 <class 'Footer'>,
 <class 'Form'>,
 <class 'Frame'>,
 <class 'Frameset'>,
 <class 'H1'>,
 <class 'H2'>,
 <class 'H3'>,
 <class 'H4'>,
 <class 'H5'>,
 <class 'H6'>,
 <class 'Header'>,
 <class 'Hgroup'>,
 <class 'Hr'>,
 <class 'I'>,
 <class 'Iframe'>,
 <class 'Img'>,
 <class 'Ins'>,
 <class 'Isindex'>,
 <class 'Kbd'>,
 <class 'Keygen'>,
 <class 'Label'>,
 <class 'Legend'>,
 <class 'Li'>,
 <class 'Link'>,
 <class 'Listing'>,
 <class 'Main'>,
 <class 'MapEl'>,
 <class 'Mark'>,
 <class 'Marquee'>,
 <class 'Meta'>,
 <class 'Meter'>,
 <class 'Multicol'>,
 <class 'Nav'>,
 <class 'Nextid'>,
 <class 'Nobr'>,
 <class 'Noscript'>,
 <class 'ObjectEl'>,
 <class 'Ol'>,
 <class 'Optgroup'>,
 <class 'Option'>,
 <class 'Output'>,
 <class 'P'>,
 <class 'Param'>,
 <class 'Picture'>,
 <class 'Plaintext'>,
 <class 'Pre'>,
 <class 'Progress'>,
 <class 'Q'>,
 <class 'Rp'>,
 <class 'Rt'>,
 <class 'Rtc'>,
 <class 'Ruby'>,
 <class 'S'>,
 <class 'Samp'>,
 <class 'Script'>,
 <class 'Section'>,
 <class 'Select'>,
 <class 'Shadow'>,
 <class 'Slot'>,
 <class 'Small'>,
 <class 'Source'>,
 <class 'Spacer'>,
 <class 'Span'>,
 <class 'Strike'>,
 <class 'Strong'>,
 <class 'Sub'>,
 <class 'Summary'>,
 <class 'Sup'>,
 <class 'Table'>,
 <class 'Tbody'>,
 <class 'Td'>,
 <class 'Template'>,
 <class 'Textarea'>,
 <class 'Tfoot'>,
 <class 'Th'>,
 <class 'Thead'>,
 <class 'Time'>,
 <class 'Title'>,
 <class 'Tr'>,
 <class 'Track'>,
 <class 'U'>,
 <class 'Ul'>,
 <class 'Var'>,
 <class 'Video'>,
 <class 'Wbr'>,
 <class 'Xmp'>]


Hey @Peter_S

Sorry for the wild goose chase! I was looking at an old version of dash_html_components (v0.7.0) which had it. Looking into the history of the repo, it looks like this commit (by me): https://github.com/plotly/dash-html-components/commit/209c114672c42b2fd43a79297bfd07496db17b43#diff-fedbf00226783695922a6b007ac03dbeL108 removed it for the following reason "remove obsolete, non-standard, or deprecated tags ".

There isn’t much more info in that commit but I believe that I removed tags based off of this list on MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Obsolete_and_deprecated_elements. Unfortunately, it looks like Menu was cut.


No worries, and thanks for the confirmation. Based on those links, I now see that it’s not at all the standard supported feature I was hoping for, and even if we had the element in Dash, as likely as not unsupported in the browser.

I’ll choc this one up in “ideas that won’t work”!

Thanks again.

Just curious, what were you looking for?

Also, it looks like we should remove contextMenu from the available properties. I made an issue for that here: https://github.com/plotly/dash-html-components/issues/48

Most broadly, just a standard method for using Right-click as an interaction method via custom ContextMenus.

I got to it specifically by hoping I could wrap a dcc.Graph with a Div that had a custom ContextMenu, and mash together the resulting menu selection click with the Graph Hover or Click data to get right-click interactions on scatter plot points.