A right-click context menu built on client-side JS commands, Floating UI, and a small LiveView hook.
Like the dropdown menu, this is a portal-free, fully client-driven menu, but it
is opened by the contextmenu (right-click) event on the trigger area rather
than a click, and it is positioned at the pointer rather than under an anchor.
The :trigger slot defines the right-clickable area. The content
<div role="menu"> carries the ShadixContextMenu hook
(assets/ts/context_menu.ts), which listens for contextmenu on the trigger,
prevents the browser's native menu, and positions the content at the pointer
using a @floating-ui/dom virtual element (computePosition + autoUpdate,
right-start/flip/shift). The hook watches the content's visibility via a
MutationObserver to manage keyboard navigation (arrows/Home/End/Enter/
Escape/Tab) and closes on outside pointerdown via the data-on-close JS
(hide_menu/1).
Trigger and content ids are derived from the required :id so data-trigger
and the JS targets line up stably.
Summary
Functions
Renders a context menu with a :trigger slot (the right-clickable area) and
arbitrary menu items.
A selectable menu item.
A non-interactive group label within a context menu.
A horizontal separator between context menu sections.
A trailing keyboard-shortcut hint within a context menu item.
Returns the Phoenix.LiveView.JS command that closes the menu with id.
Returns the Phoenix.LiveView.JS command that opens the menu with id.