Context menu
Opens a menu on right-click or Shift+F10.
<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
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
menu | MmMenu | null | The slotted menu. | ||
target | Element | null | The 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
| Method | Description |
|---|---|
openAt() | Opens the menu at a viewport point. |
openOn() | Opens the menu against an element, as the keyboard does. |
Slots
| Slot | Description |
|---|---|
| Default | The content the menu belongs to. |
menu | One mm-menu. |
Examples
Every state of mm-context-menu in Storybook, with keyboard and screen reader tests.