If your Mac app puts more than one button inside a single menu bar item, macOS 27 broke it. Every click now lands on whatever sits in the middle of the item, and it fires the moment the mouse goes down, before the user lets go.
We ran into this in Dictop, our dictation app. While recording, its menu bar item shows two controls side by side: pause, and a stop button with a timer. After upgrading to macOS 27.2, clicking pause stopped the recording. So did clicking anywhere else on the item.
The symptom
- Clicking any part of the status item triggers the control in its centre.
- The action runs on mouse-down. Holding the button and dragging away no longer cancels.
- Buttons inside the item, SwiftUI or AppKit, don't get a normal click with a real location.
The unified log shows a new line from AppKit at the moment of the press:
[com.apple.AppKit:StatusBar] 0 menu bar navigation requesting perform action at 5992.175249What changed
On macOS 27, status items are drawn by a system process, MenuBarAgent, rather than by each app's own window. Your app's item becomes a scene that MenuBarAgent shows in the menu bar. You can see this in the log too: lines such as create scene … and set up variant scene …-Variant[ActiveSnapshot-…] appear when the item is created.
MenuBarAgent catches the real mouse-down and asks the app to perform the click. AppKit then:
- builds a mouse-down and a mouse-up with the same timestamp, both at the centre of the item;
- delivers them to whatever view is at the centre, or runs the status bar button's action;
- never passes on the real mouse-up.
So event.locationInWindow is always the centre, whatever the user clicked. Views that track the mouse themselves (for example with window.nextEvent(matching:)) get the mouse-up immediately. A SwiftUI Button or an NSButton that happens to sit in the centre gets every click.
We tested several setups in small probe apps, clicking with a deliberate delay between press and release:
| Setup | What happened |
|---|---|
SwiftUI buttons in an NSHostingView inside statusItem.button | Only the centre control fired |
NSButtons as subviews of the status bar button | Only the centre control fired |
Custom view overriding mouseDown/mouseUp | Down and up arrive together, at the centre |
Deprecated statusItem.view with child views | The centre child gets every click |
button.sendAction(on: [.leftMouseDown, .leftMouseUp]) | The action fires twice, back to back, on press |
Status item with an NSMenu | Opens on press and works normally |
A few more details:
- Right-click and Control-click still arrive as their own right-mouse events, so a context menu keeps working.
- Modifier keys: the event's modifier flags come through empty, but
NSEvent.modifierFlagsstill reports them. - Double-click: each click arrives as a separate single click, so you can't detect a double-click on the item.
- There's no opt-out that we could find: no Info.plist key, no property on
NSStatusItemorNSStatusBarButton.
The macOS 27 SDK also adds NSStatusItem.expandedInterfaceDelegate and expandedInterfaceSession, which look like Apple's intended way to show richer controls from a menu bar item. The delegate takes over the click, so you can't combine it with a one-click action on the item itself.
What still works: the real cursor position
The click event's location is fake, but NSEvent.mouseLocation still reports where the cursor really is. That is enough to tell the controls apart yourself.
The fix has two parts.
1. Let left clicks through to the status bar button. Otherwise the view in the centre swallows them. Right clicks still go to your content, so a SwiftUI .contextMenu keeps working, and hovering still shows tooltips.
final class StatusItemHostingView<Content: View>: NSHostingView<Content> {
override func hitTest(_ point: NSPoint) -> NSView? {
switch NSApp.currentEvent?.type {
case .leftMouseDown, .leftMouseUp, .leftMouseDragged:
return nil // the status bar button handles it
default:
return super.hitTest(point)
}
}
}2. In the button's action, decide by cursor position. Report each control's frame from SwiftUI with a preference key in a named coordinate space that fills the hosting view, then compare it with the cursor:
@objc func statusItemClicked() {
if let pauseFrame, let hostingView, let window = hostingView.window {
let screenPoint = NSEvent.mouseLocation
if window.frame.contains(screenPoint) {
// NSHostingView is flipped, like SwiftUI frames.
let point = hostingView.convert(window.convertPoint(fromScreen: screenPoint), from: nil)
if pauseFrame.contains(point) {
togglePause()
return
}
}
}
// Everything else, and clicks with no cursor position
// (keyboard menu bar navigation, VoiceOver).
stopRecording()
}Leave sendAction(on:) at its default, or the action can run twice per click.
We tested this on macOS 27.2, on the built-in display and on an external one. On earlier macOS versions the click isn't rewritten, so the same code should behave the same way there, but we haven't tested it on macOS 26.
What doesn't work
A second status item. Giving pause its own NSStatusItem makes each control unambiguous, but on macOS 27 the new item appears at the far end of the menu bar, among other apps' items, not next to yours.
Acting on release. The real mouse-up never reaches your item, so there's no way to wait for it. Clicks on menu bar items now act on press, for every app.
Takeaways
- Treat a menu bar item as one click target. If you need several controls, open a menu or popover from it, or decide by
NSEvent.mouseLocationas above. - Don't rely on
event.locationInWindow,clickCountor mouse-up timing inside a status item on macOS 27. - If something about your menu bar item broke after the upgrade, look for
menu bar navigation requesting perform actionin Console. If it's there, MenuBarAgent is performing the click for you.