NSMenu's .sectionHeader/.separator items do not return a nil value on willHighlight method

Using NSMenuItem's delegate method menu(_ menu: NSMenu, willHighlight item: NSMenuItem?) should return a nil item when the mouse location is moved out of the NSMenu window or if any of the items should not be highlighted. As per Apple Developer website:

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.

But, on macOS Sonoma, when moving the mouse over a .sectionHeader and/or a Separator item, willHighlight won't be called, which makes it not return any item (neither nil, nor the section header).

This behavior makes it impossible to use willHighlight method to determine whether custom views should be highlighted or not.

Is this a bug or expected behavior?

  • Should be fixed in macOS 14.4. Can you confirm that it's working as expected for you in that release?

  • @Frameworks Engineer Tested on macOS 14.4 and can confirm it has been fixed and working as expected; Thanks for the response!

Add a Comment

Accepted Reply

Issue is fixed on macOS 14.4.

Replies

Reported on FB13692796.

Issue is fixed on macOS 14.4.