Focus stealing
|
|
This article contains weasel words: vague phrasing that often accompanies biased or unverifiable information. Such statements should be clarified or removed. (September 2009) |
|
|
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (September 2009) |
In computing, focus stealing is a mode error produced when a program not in focus (e.g. minimised or operating in background) places a window in the foreground and redirects all keyboard input to that window. This is considered to be an annoyance or hazard to some users[1] because the program may steal the focus while their attention is not on the computer screen, such as when typing while reading copy to the side. This will cause everything typed after the window appeared to be lost — or worse, the typed input may cause an unintended effect in the newly focussed window. On slow computers, users are sometimes not even alerted to this behaviour in time, because the associated window is only actually displayed several seconds after the actual focus change happened.
Contents |
[edit] Security issues
Focus stealing can also be damaging as the user may, while typing when their attention is away from the screen, inadvertently agree to a program doing something that causes damage. An example is when Windows pops-up the Disk Cleanup wizard and the user agrees to deleting files without realizing that the wizard was waiting for input. Focus stealing can also be treated as a security risk. For example, when a password is being typed and the typed password appears instead in a new window in an unmasked input field.
[edit] Alternatives to focus stealing
These are alternative methods for grabbing the attention of the user that could be used instead of focus stealing[2]:
- Pulse the application's icon in the taskbar, leaving the application in the background
- Output a message to the notification area
- Pulsate the display overscan area
- Use an audible alerting framework
[edit] Testing whether a window manager allows focus stealing
[edit] The launch test
Open a command-line terminal window. From within the window, run a GUI application, such as xcalc (X11) or calc (Microsoft Windows). The terminal window should remain in focus and continue to receive keypresses; press a number key to test this. If the application has gained focus so that keypresses are now being directed to the application, then the window manager allows focus stealing.[3]
[edit] The JavaScript test
On a window manager that allows focus stealing, by pointing the browser at an internet page that contains a this.focus() JavaScript facility, the browser window will regain focus [4]:
<script type="text/javascript">
function test()
{
this.focus();
setTimeout('test()',50);
};
test();
</script>
[edit] Affected systems
[edit] X Window Managers
The following window manager systems allow focus stealing:
- 9wm - fails the launch test, giving focus to window placement facility
- compiz - configurable, and capable of passing both the launch test and the Javascript test
- fvwm - configurable, and capable of passing or failing both the launch test and the Javascript test
- icewm - fails the launch test, giving focus to newly started applications
- oroborus - fails the launch test, giving focus to newly started applications
[edit] Microsoft Windows
Microsoft Windows-based systems use pop-up dialogue boxes, which can steal focus from the current application. On modern versions of Microsoft Windows, there is a system-wide setting that will by default prevent a cooperative application from stealing focus when launching another program or popping up a new window or dialogue box.[5] It is not possible to prevent an uncooperative or malicious application from either changing the setting, or bypassing it.[6]
[edit] Web Browsers
The following web browsers allow focus stealing via a this.focus() Javascript facility:
- Mozilla Firefox[7]
- Debian Iceweasel
- Debian Iceape
[edit] See also
[edit] References
- ^ http://www.google.co.uk/#hl=en&source=hp&q=focus+stealing+annoyance
- ^ Documentation released by Mark Hobley via the computer accessibility wiki
- ^ http://markhobley.yi.org/programming/gui/tests/focusstealing.html
- ^ http://markhobley.yi.org/programming/gui/tests/focusstealing.html
- ^ [1]
- ^ John Barnett's Windows XP Help and Support: How Do I Prevent Applications from Stealing Focus
- ^ Mozilla Focus Stealing bugs
[edit] External links
- Microsoft's PowerToys for Windows XP The TweakUI utility has a setting to prevent programs from stealing the focus.