views:

1032

answers:

8

Performing a search, I noticed several questions dedicated to how to steal/trap the keyboard focus of the visitor. Considering this site is dedicated to programming that's not suprising. I was wondering if anyone can advise me on how to prevent this type of behavior. Losing keyboard focus to flash basically removes my browser's functionality until I use the mouse to click elsewhere (I use Mozilla Firefox). Anyone know of some kind of plugin or greasemonkey script that will prevent my keyboard focus from being stolen? Normal browser "shortcuts" are rendered useless by having to use the mouse to return keyboard focus to the browser.

Edit: Reply to the post below, I do have flashblock / noscript and some other things. My issue is flash that I want to see/interact with stealing my focus. Basically looking for something I can toggle that will prevent flash from getting keyboard focus or a way to force my firefox keyboard commands to the browser

A: 

If you're using Firefox, you can try Flashblock to disable unwanted Flash.

sunny256
It's not that we don't want to use the flash program, but that we want to be able to take focus away from it without using the mouse.
stu
+1  A: 

Alt-Tabbing to your current app will return focus.

UltimateBrent
A: 

Alt-Tabbing doesnt seem to work

SH
this is a comment, not an answer
Derek Adair
A: 

I think it is not possible that flash gets the keyboard focus automatically in firefox. It is possible with the IE.

Focus
A: 

This bothers me, too. It's not only a problem with Flash taking focus automatically. I could be viewing a youtube video or something, then alt+tab to something else. When I alt+tab back to my browser (Opera), I want to ctrl+tab to another page, or ctrl+t to a new page, but Flash still has focus and it doesn't work.

mo
+1  A: 

Similar question: http://stackoverflow.com/questions/254111/flash-steals-browser-focus

The (not accepted but looks promising) answer of:

 document.body.focus();

may work for you. That can easily be greasemonkeyed. Probably.

zaf
A: 

First, check to make sure you are using a flash player higher than version 6.0. Also, another responder was correct. FireFox should not automatically take focus of inline flash content...it isn't designed that way.

Secondly, This is not just an annoyance, this is an accessibility concern. Those users who can only navigate with a keyboard or assistive device like a screen reader will not be able to escape...because they don't/cant't use a mouse.

To avoid flash in keyboard navigation, or to hide unimportant Flash content from both web browser and screen readers, add the wmode option with a value of opaque to both the object and embed tags of the web page containing the Flash movie or swf.

Example of code:

<object ...>
<param name="wmode" value="opaque">
<embed wmode="opaque" ...>
</embed>
</object>

This will effectively hide the Flash movie from the screen reader/assistive device and the keyboard. It will still appear visibly within the page, but while navigating through the page, the keyboard will bypass the Flash content and the screen reader will act as if it isn't even there.

HOWEVER!!!! If the movie/swf DOES contain important information, either display the Flash movie in a page by itself or include the link to download the latest version of the Flash player and inform users that they need to use this version. -- Of course, you should then make your flash piece keyboard navigable.

DOWNFALL OF FLASH: Natively keyboard navigable flash is ONLY -- I repeat ONLY available in Internet Explorer...BECAUSE Adobe/Macromedia designed "Accessible Flash" to work with MSAA (Microsoft Active Accessibility) technology and the only browser that supports MSAA technology is Internet Explorer.

Todd
A: 

Unfortunately, it is almost a decade old well known FF bug(and now in Chrome too), which is not present in IE. (https://bugzilla.mozilla.org/show_bug.cgi?id=78414 ). All the Ctrl. T, Ctrl + Tab, Ctrl. W etc. keys just stop working when the focus is on a flash object.

The worse thing is, no one seems to know the fix for it yet(see the thread above). Some IBM people made a hack fix for Linux (http://www.ibm.com/developerworks/opensource/library/os-78414-firefox-flash/index.html), but there is none for windows. It is really really annoying.

Piyush Soni