HACKER Q&A
📣 joshuak

Why does macOS still lack focus stealing prevention in 2025?


Been dealing with this forever and finally went down the rabbit hole to understand it properly.

  The issue: macOS lets any app steal your keyboard focus whenever it wants. Technically, apps just call [NSApp activateIgnoringOtherApps:YES] and boom - your keystrokes are going somewhere else.

  Why I care:
  - I've typed passwords into the wrong window more than once
  - Constant interruptions kill flow
  - VoiceOver users have it way worse - they lose their whole navigation context

  Here's the frustrating part: this has been solved everywhere else for ages. Windows added ForegroundLockTimeout back in XP (2001). X11 window managers have had this forever. GNOME and KDE have had settings for it for decades. There's literally a Wikipedia article about it: https://en.wikipedia.org/wiki/Focus_stealing

  Jeff Atwood nailed it back in 2007: "Stealing focus from the user is never acceptable."

  I've tried everything - defaults write tricks, Hammerspoon scripts, random third-party apps. Nothing works reliably.

  All we need is one checkbox in System Settings. Apps that want attention bounce in the Dock instead of hijacking your keyboard. That's it.

  The accessibility angle is what gets me - Apple talks a big game about accessibility, but this is a real gap. What's a 2-second annoyance for me is a 30+ second disruption for screen reader users.

  Filed feedback (FB21568202). Curious if anyone's found workarounds that actually stick.


  👤 daviddever23box Accepted Answer ✓
Windows may not steal your keyboard focus, but it will block the very thing you're trying to do with useless dialogue boxes.

Notifications should be non-blocking. ALWAYS.


👤 alphadatavault
This is a perfect example of the tension between Apple’s HIG (which explicitly discourages focus stealing) and the actual implementation of AppKit. activateIgnoringOtherApps:YES is effectively a "selfish" API—it assumes the developer's intent is more important than the user's current context.

The fact that we have to rely on Hammerspoon or defaults write hacks in 2026 is a testament to the "black box" nature of WindowServer. It’s one of the few areas where macOS feels significantly less mature than Linux/X11, where "Focus Stealing Prevention" has been a standard toggle for decades.


👤 al_borland
WebEx is very guilty of this any time sharing is invoked or changes hands.

I usually just curse at it and call it names.


👤 bigyabai
I'm not sure, but if you've reached the point that you're sending AI-generated pleas to the community then you might as well switch to Linux or Windows.