FLEX-34353 fix shift-tab focus transfer from IE address bar
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/fae2059b Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/fae2059b Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/fae2059b Branch: refs/heads/master Commit: fae2059b98645d90abad9b04e3a1d320155b2001 Parents: 3eb9d6d Author: Alex Harui <[email protected]> Authored: Fri Jun 20 23:14:12 2014 -0700 Committer: Alex Harui <[email protected]> Committed: Fri Jun 20 23:14:12 2014 -0700 ---------------------------------------------------------------------- .../framework/src/mx/managers/FocusManager.as | 27 ++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fae2059b/frameworks/projects/framework/src/mx/managers/FocusManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/managers/FocusManager.as b/frameworks/projects/framework/src/mx/managers/FocusManager.as index 27da1eb..a9d4c1f 100644 --- a/frameworks/projects/framework/src/mx/managers/FocusManager.as +++ b/frameworks/projects/framework/src/mx/managers/FocusManager.as @@ -112,6 +112,9 @@ public class FocusManager extends EventDispatcher implements IFocusManager */ public static var mixins:Array; + // flag to turn on/off some ie specific behavior + mx_internal static var ieshifttab:Boolean = true; + //-------------------------------------------------------------------------- // // Constructor @@ -706,7 +709,7 @@ public class FocusManager extends EventDispatcher implements IFocusManager { dispatchEvent(new FlexEvent(FlexEvent.FLEX_WINDOW_ACTIVATE)); // restore focus if this focus manager had last focus - if (_lastFocus && !browserMode) + if (_lastFocus && (!browserMode || ieshifttab)) _lastFocus.setFocus(); lastAction = "ACTIVATE"; } @@ -1624,7 +1627,7 @@ public class FocusManager extends EventDispatcher implements IFocusManager calculateCandidates = false; } - // trace("focus was at " + o); + // trace("focus was at " + fromObject); // trace("focusableObjects " + focusableObjects.length); var i:int = fromIndex; if (fromIndex == FROM_INDEX_UNSPECIFIED) @@ -1633,6 +1636,8 @@ public class FocusManager extends EventDispatcher implements IFocusManager var o:DisplayObject = fromObject; if (!o) o = form.systemManager.stage.focus; + else if (o == form.systemManager.stage) + o == null; o = DisplayObject(findFocusManagerComponent2(InteractiveObject(o))); @@ -2084,8 +2089,26 @@ public class FocusManager extends EventDispatcher implements IFocusManager return; } + if (ieshifttab && lastAction == "ACTIVATE") + { + // IE seems to now require that we set focus to something during activate + // but then we get this keyFocusChange event. I think we used to not + // need to set focus on activate and we still got the keyFocusChange + // and then stage.focus was null and we'd use the keyFocusChange event + // to determine which control (first or last) got focus based on + // the shift key. + // If we set focus on activate, then we get this keyFocusChange which moves + // the focus somewhere else, so we set fauxFocus to the stage as a signal + // to the setFocusToNextObject logic that it shouldn't use the stage.focus + // as the starting point. + fauxFocus = sm.stage; + } // trace("tabHandled by " + this); setFocusToNextObject(event); + if (ieshifttab && lastAction == "ACTIVATE") + { + fauxFocus = null; + } // if we changed focus or if we're the main app // eat the event
