Skip to main content

Context menu

Opens a menu on right-click or Shift+F10.

…asset rows…
Copy MRN Delete asset
<mm-context-menu>
<table>…asset rows…</table>
<mm-menu slot="menu" label="Asset actions">
<mm-menu-item icon="content-copy" value="copy-mrn">Copy MRN</mm-menu-item>
<mm-menu-separator></mm-menu-separator>
<mm-menu-item icon="delete" danger value="delete">Delete asset</mm-menu-item>
</mm-menu>
</mm-context-menu>

Guidance​

A context menu offers the actions for whatever was right-clicked: a row in an assets table, a node on the lineage canvas. It wraps that content and opens its mm-menu (in the menu slot) at the pointer, or at the focused element when opened with Shift+F10 or the Menu key. Context menus always appear instantly. Every action in one must also be reachable another way, such as a row's "More" menu button, because right-click is not discoverable.

Keyboard: Shift+F10 or the ContextMenu key opens the menu; inside it, the menu keyboard model applies (https://www.w3.org/WAI/ARIA/apg/patterns/menu/), and Escape returns focus to where it was.

Properties​

PropertyAttributeTypeDefaultDescription
menuMmMenu | nullThe slotted menu.
targetElement | nullThe element the menu was last opened on: the right-clicked or focused element. Read it in mm-select to know which row to act on.

Methods​

MethodDescription
openAt()Opens the menu at a viewport point.
openOn()Opens the menu against an element, as the keyboard does.

Slots​

SlotDescription
DefaultThe content the menu belongs to.
menuOne mm-menu.

Examples​

Every state of mm-context-menu in Storybook, with keyboard and screen reader tests.