[ 
https://issues.apache.org/jira/browse/FLEX-33934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14239643#comment-14239643
 ] 

Alex Harui commented on FLEX-33934:
-----------------------------------

Delaying focus via callLater has been problematic.  Various subsystems like 
mustella had to learn that they could not trust stage.focus because a TAB could 
come in before the callLater sets stage.focus.  Rather than applying this sort 
of logic to other components or trying to come up with some sort of handshake 
with the FocusManager, it might be time to revert FLEX-33537 and find a 
different solution.

> Holding Shift+TAB pressed in DataGrid makes focus jump to textField outside 
> grid, then back to grid editors, and so on
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLEX-33934
>                 URL: https://issues.apache.org/jira/browse/FLEX-33934
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Focus Manager, Spark: DataGrid
>    Affects Versions: Apache Flex 4.11.0
>         Environment: Windows 8, Adobe AIR 3.9
>            Reporter: Mihai Chira
>         Attachments: _DataGridFocus.fxp
>
>
> Steps to reproduce:
> 1. Import and run the attached project.
> 2. Double click on Brazil to enter edit mode
> 3. Press and hold Shift+TAB to tab backward through components
> Actual behaviour: focus jumps back and forth between the grid's item editors 
> and the text field outside the grid.
> Desired behaviour: focus jumps backward only through the editors, not 
> involving the text field outside the grid.
> Note: this happens without problems when Shift+TAB is pressed with lower 
> frequency.
> Note: in our application we have the same problem with the forward focus 
> (Shift not pressed), which I could not reproduce in this simple app. And 
> since we're creating many grids whose cells should be editable similarly to 
> Microsoft Excel's, the priority for us is high.
> Hints:
> 1. From my understanding, DataGridEditor.editor_keyFocusChangeHandler() and 
> FocusManager.keyFocusChangeHandler() respond to the same event 
> (FocusEvent.KEY_FOCUS_CHANGE), but listen to different objects for it. When 
> things work correctly, DataGridEditor reponds to the event once the user 
> presses (Shift+)TAB in a grid's item editor, and (does the necessary work to 
> create and focus the next editor and then) calls preventDefault() on the 
> event, which tells the FocusManager not to apply its default behaviour. All 
> works fine.
> 2. However, when (Shift+)TAB is held pressed, or pressed very quickly, what 
> seems to happen at times is that 
> DataGridEditor.editor_keyFocusChangeHandler() is never called. From what I 
> can tell from tracing the event instance in FocusManager, that's because the 
> event's target is no longer the textDisplay inside the item editor, but the 
> strange 
> "_DataGridFocus0.WindowedApplicationSkin2.Group3.contentGroup.__DataGridFocus_DataGrid1.UIComponent37"
>  instance. This means that DataGridEditor cannot respond to this event, since 
> it's not thrown by the editor it's listening to.
> 3. I also put traces where the editor is removed and where it's created in 
> DataGridEditor, which showed that when the unusual event is thrown (see hint 
> #2) the item editor is still not null, is still on stage, and still has the 
> event listener for FocusEvent.KEY_FOCUS_CHANGE. So it's not that the editor 
> has been destroyed - it's just that the event is thrown by another component.
> NOTES:
> * using selectedIndex instead of selectedItem works without error.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to