TabIndex problems using PopUpManager

I recently spent some time trying to figure out why the controls on a Flex popup window didn’t seem to have any tab index. While debugging the problem I found that the focusManager was null for the popup window. I finally discovered that the PopUpManager will only automatically create a FocusManager if the popup window implements IFocusManagerContainer. It turns out that the spark VGroup component does NOT implement that interface. After switching to a BorderContainer (with a VerticalLayout) tabbing worked as expected. Here’s an example demonstrating the problem and solution (view source enabled).

Update: As JabbyPanda points out in the comments, you can take advantage of this behavior to disable the focus behavior in a popup by using a Group container. This appears to be the strategy employed by the ComboBox component.

Tagged with:

4 Responses to “TabIndex problems using PopUpManager”

  1. JabbyPanda says:

    Thanks for the highlighting the fact that Group container does not implement IFocusManagerContainer.

    I was just looking how to achieve exactly the opposite task to yours – how to prevent passing the focus to controls on a Flex popup window and your finding is very helpful.

    I will just wrap Spark List component (which implements IFocusManagerContainer) in Group container.


     <s:VGroup width="100%">
         <s:List id="list2" width="100%">
                         <fx:Object label="Application" />
                         <fx:Object label="BorderContainer" />
                         <fx:Object label="Button" />
                         <fx:Object label="ButtonBar" />
                         <fx:Object label="ButtonBarButton" />
                         <fx:Object label="CheckBox" />

  2. Josh says:

    This does not work for me. my sub view is a bordercontainer as well. im using flas builder 4

  3. Thanks for this … your tip with the IFocusManagerContainer worked like a charm. I simply implemented this simple interface in my base Dialog class and now my tabbing worked as expected … good job 🙂