Question

This question is related to (but distinct from) my other question here: Give focus to browser

I have an embedded flash object on my page, and I want it to be included in the tab cycle. I've set tabindex on it, which works in FireFox but in Google Chrome and Apple Safari focus still slips past.

Here's some simple test code:

<a href="#" tabindex=1>A</a>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width=550 height=400 id=movie_name tabindex=1>
    <param name=movie value="http://helpx.adobe.com/content/help/en/flash-player/kb/find-version-flash-player/_jcr_content/main-pars/flash_1/file.res/theFile.swf"/>
    <embed src="http://helpx.adobe.com/content/help/en/flash-player/kb/find-version-flash-player/_jcr_content/main-pars/flash_1/file.res/theFile.swf" name=movie_name type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" tabindex=1 />
</object>
<a href="#" tabindex=1>Z</a>
<button onclick="document.movie_name.focus()">Force focus into Flash</button>

(in a fiddle: http://jsfiddle.net/tcDGq/)

Everything has a tabindex of 1 (I also tried variations on 0, 0,1,2, etc), but it is impossible to focus the flash object with the keyboard. Clicking on it works, as does pressing the button, which triggers a simple bit of JavaScript. You can tell if it's focussed by mashing TAB; it will never give up focus via the keyboard so you'll never see anything highlight.

OK so I could hack together a fix which intercepts the TAB key and forces the focus in particular situations, but frankly that's a hideous solution. Is there some attribute I've missed here? I'm looking for a pure HTML fix if possible.

Was it helpful?

Solution

Turns out this is a known bug in WebKit, and therefore effects both Chrome and Safari (not FireFox, and I have no idea about Internet Explorer or Opera)

The relevant tracker is here: https://bugs.webkit.org/show_bug.cgi?id=32292

Coincidentally, this was resolved a few days ago, so hopefully it will be in a public release soon. Since both Chrome and Safari manage to keep most users up-to-date, I don't think it's worth building a workaround in the meantime (but if anybody does have a nice workaround, please post it here!)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top