The menu at the pointer is a context menu — right-click (or click) the folder to toggle it
Context Menu
/ NSMenu · View.contextMenu(menuItems:) /
also called contextual menu, right-click menu, shortcut menu
A context menu exposes actions relevant to the object under the pointer and opens from a secondary click or Control-click. It appears near that click and is made from standard menu items, separators, keyboard equivalents, and submenus. A dropdown menu has a visible control that opens it with a primary click, while a context menu is invoked directly from the content.
If you called it…
…you meant a context menu.
Anatomy — every part, named
- 1Selection highlight
NSMenuItem“The blue bar behind the option under the pointer” is the menu item's selection highlight.
- 2Separator item
NSMenuItem.separator()“The little line between groups of right-click options” is a separator item.
- 3Key equivalent
NSMenuItem.keyEquivalent“The keyboard shortcut text on the right” is the item's key equivalent.
Prompt — paste into your agent
Add a Context Menu using NSMenu on the target NSView (SwiftUI: View.contextMenu), opened by right-click or Control-click at the item under the pointer. Populate it with actions specific to that item; do not turn it into a primary-click dropdown anchored to a button.
Debug prompt — when it misbehaves
Paste this, then describe what you’re seeing — it hands your agent the classic failure modes to rule out first.
Debug my macOS context menu (NSMenu, menu(for:), SwiftUI .contextMenu). Rule out: the menu built once and gone stale — implement menuNeedsUpdate/menuWillOpen; items greyed out because their target is nil and nothing in the responder chain implements the action; right-click, control-click and two-finger tap taking different code paths; a SwiftUI .contextMenu swallowing plain clicks on the row. The symptom:
In code
The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).
| AppKit | NSMenu | |
| SwiftUI | View.contextMenu(menuItems:) | |
| AppKit | NSView.menu | the contextual menu associated with a view |
| AppKit | NSMenuItem |