UPDATE:
The "NSStatusItem does not receive mouse hover/movement events on macOS" (FB23329983) seems to be fixed in macOS 27 dev beta 5 (build 26A5406e).
The following issues still remain:
inability to set NSStatusItem button highlight cannot be set programmatically (B23330269), for which expandedInterfaceDelegate gives a partial solution.
NSStatusItem window occlusionState no longer reflects hidden menu bar visibility (FB23349447)
Additionally, there is a somewhat serious design issue/oversight with expandedInterfaceDelegate and expandedInterfaceSession when it comes to implementing touch support. With a custom menu bar extra window implementation (when one uses a custom NSWindow or NSPanel and for the menu bar extra app's window together with the new expandedInterface..., instead of relying on the traditional NSMenu or NSPopover attached to a menubar extra status item) there is no mechanism at all to detect touch tap gesture outside of the window. This would be essential to figure out when the user wants to dismiss the menubar extra window.
Previously, the normal pattern was to use a global event monitor to act when the user clicks outside of the window - with this the app could trigger closing the menubar extra window. Touch events are not covered by this mechanism and there is no alternate API of any kind. So menubar extra apps (which do not use NSMenu or NSPopover or the basic SwiftUI menubar extra solution) simply don't have any means to detect the user intent to close the menubar extra window (when the user taps outside of the window). A less than ideal workaround may be to track loss of key window status maybe, but that is not fool-proof, especially if one designs an app in a way that the menubar extra window does not grab key status or focus at all.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: