<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSMenuDelegate/menu(_:willHighlight:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSMenuDelegate(im)menu:willHighlightItem:"
  },
  "title" : "menu(_:willHighlight:)"
}
-->

# menu(_:willHighlight:)

Invoked to indicate that a menu is about to highlight a given item.

```
@MainActor optional func menu(_ menu: NSMenu, willHighlight item: NSMenuItem?)
```

## Parameters

`menu`

The menu object about to highlight an item.

`item`

The item about to be highlighted.

## Discussion

Only one item per menu can be highlighted at a time. If `item` is `nil`, it means that all items in the menu are about to be unhighlighted.

## See Also

[`var highlightedItem: NSMenuItem?`](/documentation/AppKit/NSMenu/highlightedItem)

Indicates the currently highlighted item in the menu.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)