Various menu bar NSStatusItem issues with macOS 27

It seems like macOS 27 beta 2 has some issues with NSStatusItem buttons added to the menu bar - this creates difficulties for some menu bar extra apps.

  1. NSStatusItem buttons does not receive mouse hover/movement events - FB23329983

On macOS 27, views inside an NSStatusItem button no longer receive hover or mouse-movement events. The same code works correctly on macOS 26. What I tried:

  • An NSTrackingArea attached to a subview of NSStatusBarButton
  • An NSTrackingArea attached directly to the status-bar button
  • Replacing NSStatusItem.view with a custom view
  • Embedding an NSHostingView and using SwiftUI onHover/onContinuousHover
  1. NSStatusItem button highlight cannot be set programmatically. - FB23330269

The following code no longer has any effect (does not provide the highlight capsule):

NSStatusItem.button?.highlight(true)

  1. NSStatusItem window occlusionState no longer reflects hidden menu bar visibility - FB23349447

The following no longer works:

statusItem.button?.window?.occlusionState.contains(.visible)

These changes may be related to some of the touch related changes or maybe it's about how menu items are now seemingly more "managed" in a way that their position, visibility may change in a way that is transparent/undetectable to the app.

All these seem to be broken in macOS 27 dev beta 3 (26A5378j) as well.

Update: to solve the button highlight issue, one should use NSStatusItem's new expandedInterfaceDelegate.

https://developer.apple.com/documentation/appkit/nsstatusitem/expandedinterfacedelegate

Mouse tracking and occlusion detection of an NSStatusItem (or its button) is still an unresolved issue, there is no modern alternative afaik.

But of course the expandedInterfaceDelegate does not solve the issue of programmatically creating a highlight (for the purposes of programmatically showing the menubar app window or showing an OSD interface tied to the menubar extra icon), so this is not a complete replacement - it just helps to fix the lack of highlight when an user starts interacting with the NSStatusItem.

Hello @Steve4442,

Thanks for filing these reports and providing a solution. I've included the highlight solution you shared in the report so the relevant engineering team is aware of this workaround.

As for the other two reports:

  • NSStatusItem buttons does not receive mouse hover/movement events - (FB23329983).
  • NSStatusItem window occlusionState no longer reflects hidden menu bar visibility (FB23349447).

Are you able to upload a minimal sample project that reproduces the issue? You can do this with Feedback Assistant

This way the engineering teams who receive your report can see exactly what you are seeing. If you share your code here as well, I and others can offer direct workarounds and suggestions if any are available.

Thank you for reporting! Updates generally are provided through Feedback Assistant, keep an eye on your reports for status updates.

 Travis

Various menu bar NSStatusItem issues with macOS 27
 
 
Q