assertTrue is the professional blog of Luke Bayes and Ali Mills

Firefox and Flash SWF selection and focus problems

Posted by Luke Bayes Sat, 18 Nov 2006 01:02:00 GMT

Ali and I have been providing support for the past couple of months on a large application that we built and deployed earlier this year. We had an interesting bug filed today and I set about trying to address it.

The bug is this:

If I click around in the SWF application, and especially if I select a text input field at some point, I can no longer edit the Firefox Location bar (Address bar).

In addressing this issue, I immediately suspected our focus/selection management layer, then moved on to our TextInput controls, and eventually wound up scouring the web to see if anyone else reported the same problem. As it turned out, I still haven't found anyone else reporting this issue, but in my searching - I did discover the root cause.

It's the "wmode" parameter of the embed tag. As far as I can tell, this attribute can be set to "opaque", "transparent" or not set at all. Setting it with an empty value, or an unexpected one appears to default to the opaque behavior. NOT declaring it at all behaves very differently as I soon discovered...

I was surprised to find an issue with this setting because we're using the swfObject deployment package and it came highly recommended. As it turned out, there doesn't seem to be much the swfObject folks could have done, and by not declaring this property at all, they in fact chose the least of 3 evils...

After finding out about this attribute, I immediately set it to "opaque" in my embed tag and found that my bug disappeared. I was so excited I started integrating and was just about to check in to version control, when it occurred to me that this setting might actually have side-effects beyond the background opacity... As a last minute double-check, I began searching google for the meaning of this parameter and quickly learned that this seemingly innocuous little attribute was sitting on top of a giant mountain of subtle bugs...

Following are the side-effects that I discovered:

*NOTE: All of these behaviors are Firefox-related, and I'm only editing the embed tag, so IE users probably won't get much benefit from this page.




Flash Movies:

wmode null (no attribute declared): clicking around in this movie will disallow direct selection/editing in the location bar.
In fact, the location bar will allow you to select it, but input focus will not leave the swf if the next-selected item is the location bar. Oddly, you *can* select the Firefox search input, and *then* the location bar!

wmode="opaque": Clicking in this movie will appropriately allow you to select and edit the location bar.
Unfortunately, setting this property has the following problems:

  • I-Beam does not show up in editable text fields
  • ScrollWheel doesn't seem to work at all. (Others reported that: OnMouseWheel events return ScrollTarget ~50-60 pixels away from the mouse, but I can't get the swf to even capture scroll wheel events...)

wmode="transparent": This setting *does* allow us to select the location bar, but after quite a bit of searching, it seems that setting wmode to transparent creates a whole host of problems in firefox, Following are some of what others found:

  • Key.isDown() returns false every time
  • I-Beam does not show up in editable text fields
  • ScrollWheel doesn't seem to work at all. (Others reported that: OnMouseWheel events return ScrollTarget ~50-60 pixels away from the mouse, but I can't get the swf to even capture scroll wheel events...)
  • Non-US keyboard layouts revert to US key codes
  • Reported degradation in performance


In closing, I sure hope someone is able to address these issues.
I'm planning on doing some more research over the weekend and hopefully reporting the bug to Firefox and/or Adobe. I suspect that some of these issues fall into each camp...
It just makes me sad to lose a day of productivity chasing such strange integration bugs that seemingly should have been found before one or another of these products were released...


Resources:
Following are some links to what other folks had to say on some of these issues:

[Update 11/20/2006]

I just verified that this issue can be reproduced in the Adobe Exchange using Firefox 2.0, but *not* using Firefox 1.5.0.8. The problem does reproduce here using both versions of Firefox. I'm intensely curious about how Adobe is embedding that swf, but can't easily get at the page source thanks to iframes and linked js files... Is anyone else seeing the same problem?

Tags ,  | 6 comments

Comments

  1. Bob commented: Avatar I have the same problem. I have removed firefox, quicktine, and flash and reinstalled all of them and the same problem on my desk top (dell running xp home edition). Yet I do not have this problem on my toshiba laptop runing windows xp media edition. Both have sp2 installed are are both up to date on all windows fixes and patches.
    Posted: 22 days later.
  2. Bob replied: Avatar Finally found my problem. Its with quicktime. Had to open Control Panel and open quicktime there. Under file types, had to un-check "flash media" That seems to fix the problem of getting the quicktime logo instead of playing the flash movies.
    Posted: 23 days later.
  3. Bob commented: Avatar I'm experiencing this same problem with a website that I'm working on. I need the wmode to be opaque because I want to layer some iframes on top of the Flash. Is there any fix or workaround at all for this (other than not using opaque)?? Here is my website as it is now: http://www.burpum.com/ If you see on the homepage, when you click in the "Sign-up" text fields, there is NO blinking I-beam cursor...very frustrating as this is only the case on Firefox (IE works fine so far) :( One thing interesting that I noticed though...when you remove focus from Firefox by clicking on another application (or clicking and holding down on an application in your Windows toolbar, the I-beam cursor starts to blink). It seems to blink fine as long as it's not the focused window.
    Posted: 41 days later.
  4. Renaun Erickson replied: Avatar Did you try wmode="window"?
    Posted: 59 days later.
  5. Renaun Erickson commented: Avatar We are messing with a focus issue, where wmode=opaque fixed our issue. The SWF is a Flex AVM2 SWF and doesn't seem to have the issues you mention above (I-Beam and Scroll Wheel). Using Firefox 2 and SWFObject.
    Posted: 59 days later.
  6. Angelo replied: Avatar Thanks Luke, I removed the wmode attr and it worked great. Using FF 2.0.0.1
    Posted: 72 days later.

Your Reply

Comment Form.

Fields denoted with an "*" are required.