Some desktop Operating System (OS) do spontaneously switch focus among applications without the user being aware of it. A typical issue is when you are typing in text editor and suddenly another app comes to foreground without warning and your keystrokes are directed to it. It often happens when an application is launched in the background and takes time to load up. Or when you load a large file in an app, then switch to another and a minute or so later the first app grab the focus because the file is loaded.

I find the practice not only annoying but I also think it is a security risk. For instance if you are entering a password and suddenly another app gets the focus it is easy to leak confidential information. Another risk is when the keystrokes intended for one app actually trigger unwanted actions in another (e.g. delete folder in a file manager).

I know MS Windows and Ubuntu have this issue, not sure about Mac OS and others. You can find questions on SO where people ask for work-around on their specific OS so it seems I'm not the only one finding this default behaviour irritating.

I'd be interested to know why OSes have this default behaviour despite the drawbacks explained above and why they don't seem to offer built-in config settings to disable it?

Another related question is if there are existing UX patterns that could be used to solve this issue? One I can think of is a temporary message box in a corner of the screen to attract attention to an application, just like an email client does when a new email has been received.

2 Answers 2


The issue of focus stealing is well-known. In the Linux world, some desktop environments like Xfce have options to prevent it. GNOME 3 also prevents it by default.

In terms of security, the reality is a lot more complex, as until recently (~2011 and forward), graphic stacks had little to no protection against unprivileged apps listening in on the keyboard input that is meant for another unprivileged app. This is why keyloggers have existed in the first place.

Since it's the same piece of architecture that is responsible for dispatching keyboard input and for handling focus, it's no surprise that the security implications of focus stealing haven't been systematically tackled yet. In the Linux world, we've identified this issue and we now know how to prevent it from happening in the soon-to-be-standard new graphic stack (a project called Wayland, which will replace X.Org).

I don't feel like ux.SE is a very good audience for discussing OSs, but I've covered this topic on security.SE and at the X.Org Developer Conference:

I particularly invite you to read the two blog articles accompanying the XDC 2014 talk, where we explain exactly what happens when a fullscreen app steals focus to steal your password. Apps should not be able to steal focus and be fullscreen, and they should not be able to steal focus whilst another app declares it is currently receiving sensitive input. This can all be achieved in the implementation of an OS's graphic stack, and the principles are now out there and well understood (albeit the UX of interactions related to focus stealing has not been publicly evaluated for any OS).


This behaviour is in most cases part of the "annoying" applications implementation. The OS just provides the means of bringing the own application window into focus. This function has to be provided by the OS and without this function some applications might be rendered unusable (think File Explorers that would not be able to move the opened document to the front). The applications stealing focus should be either made configurable or the OS should provide a global switch or means of controlling this behaviour. The UX Solution are the various notification centers/notification areas found in modern operating systems. Mac OS, Windows, most Linux desktops and all mobile operating systems provide a notification system that queues upcoming annoyances for the user to be viewed at a later time.

  • Notifications are really inappropriate mechanisms here. Focus stealing, with some apps, occurs on a constant basis (e.g. Messenger using Android screen overlays), so notifications would infuriate users. There has to be some control of who is allowed to steal focus (via complete mediation and setting appropriate policies for each app), and the ability to disable it when an app is receiving input it deems sensitive (a reason why Android blocks changing security settings when a screen overlay app is active). Nov 5, 2016 at 15:53
  • I meant non intrusive notifications like android is offering. Nov 5, 2016 at 15:56
  • Oops, sorry! I read too quickly! This would not provide much of a useful role however, I suspect. You don't think to look at your status bar to check if some overlay is opened when typing some password in, just like you don't look at certificate status icons when going onto a new website. Passive notifications fail because looking at them is not part of the normal journey of the user's focus in any task they perform. Nov 5, 2016 at 16:21
  • Certificate warnings are meant to interrupt the users flow. This is not what the OP had in mind i think. Nov 6, 2016 at 7:48
  • Yeah, and they came along because the previous passive notification approch failed to deliver. Nov 6, 2016 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.