Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Adobe Flex SDK 3.4 (Release)
-
None
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Language Found: English
Description
Currently, if you use a tabIndex for any control in your app, the Focus Manager switches to a mode where it only uses tabIndexes. If you use no tabIndexes, then it will determine the tab order based on parent/child relationship.
The FocusManager gives you no easy way to override this behavior. At a minimum, the sortFocusableObject method should be protected. Then at least the developer can override the default behavior and add their own.
Another issue is that of performance. If you look at the sortByDepth function which get's called over and over during the Array.sort routine, you'll notice that each object is having it's "sorting string" determined over and over again. This operation requires a decent amount of steps and should be temporarily cached per item in my opinion.
In my case, I needed a combination tabIndex and byDepth sort. In my gui for the most part, byDepth was kind of ok. However, I have multiple container objects. The items within the containers were doing nicely using the byDepth sort. However, I needed to control the tab order of the containers themselves and byDepth uses "child index". In my case, I needed to adjust the child index (regardless of tab order) to achieve a desired visual overlap of these containers. Because of this, I need a hybrid sorting algorithm. That is, one that took into consideration tabIndex and childIndex if tab index didn't exist. When you think about it. It's all about the string you use to represent the object when sorting. I call this the "sorting id". So, I needed to create a descendant of the FocusManager that implemented this new "sorting id". Unfortunately everything is private so I needed to copy the entire class and modify the code and put it in my source path. This is annoying especially when updating the SDK later on and trying to patch the new SDK with your changes, as I needed to do going from 3.3 to 3.4
If anyone is interested in my workaround. I'll attach it. Just search for "MAD" (my initials) and you'll see the code I added. This file is from the 3.4 SDK (with my changes).