Context menu
The menu that appears right where you right-clicked or long-pressed, listing actions for that exact thing.
See it
What it is
A context menu is the list of actions that appears at the pointer when you right-click, control-click, or long-press. The whole point is the context: items are about the specific thing you targeted, so right-clicking a file offers Rename and Delete while right-clicking empty space offers New Folder and Paste.
Reach for it in dense, tool-like interfaces: file managers, canvases, editors, data grids. It is a power-user accelerator, never a primary route, because nothing on screen advertises that it exists. Everything inside it should also be reachable from a visible path such as a toolbar or an overflow menu.
Gotchas: you have to call preventDefault on the contextmenu event to replace the browser's own menu, and people resent losing that menu where they expect it, so only override where you genuinely add something. Touch has no right-click, so the trigger becomes a long press, which fights text selection and scrolling. And a menu rendered inside an overflowing container gets clipped: portal it to the body and clamp it to the viewport.
Ask AI for it
Build a custom context menu for this file list: on contextmenu (and long-press on touch) call preventDefault and open a floating menu at the cursor position, portalled to document.body and clamped so it never overflows the viewport. Items are Open, Rename, Duplicate, a separator, then Delete in red, each with a leading icon and a right-aligned keyboard shortcut hint. Support arrow-key navigation, Escape to close, click-outside to dismiss, and focus return to the targeted item. Fade and scale in from 0.95 over 120ms with the transform origin at the cursor.