Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4F03910958 for ; Mon, 21 Oct 2013 22:39:15 +0000 (UTC) Received: (qmail 72347 invoked by uid 500); 21 Oct 2013 22:37:08 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 71867 invoked by uid 500); 21 Oct 2013 22:36:54 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 71838 invoked by uid 99); 21 Oct 2013 22:36:53 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Oct 2013 22:36:53 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A3D1C4F8D2; Mon, 21 Oct 2013 22:36:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jmclean@apache.org To: commits@flex.apache.org Date: Mon, 21 Oct 2013 22:36:53 -0000 Message-Id: <652a01fd99d8486a810ba30b9105766d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/50] git commit: [flex-sdk] [refs/heads/master] - FLEX-33772 Incorrect tab focus behaviour Updated Branches: refs/heads/master 504abed4b -> db1aa1e6a FLEX-33772 Incorrect tab focus behaviour Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/edb146e5 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/edb146e5 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/edb146e5 Branch: refs/heads/master Commit: edb146e5aac2fe6db826925fd680e82dad6132f4 Parents: 8eddfd0 Author: Justin Mclean Authored: Fri Oct 11 10:16:36 2013 +1100 Committer: Justin Mclean Committed: Fri Oct 11 10:16:36 2013 +1100 ---------------------------------------------------------------------- .../framework/src/mx/managers/FocusManager.as | 95 ++++++++++++++++---- 1 file changed, 79 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/edb146e5/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 4af19fd..6f17a07 100644 --- a/frameworks/projects/framework/src/mx/managers/FocusManager.as +++ b/frameworks/projects/framework/src/mx/managers/FocusManager.as @@ -1379,29 +1379,92 @@ public class FocusManager extends EventDispatcher implements IFocusManager var o:DisplayObject = DisplayObject(findFocusManagerComponent2(focusableCandidates[i])); if (o is IFocusManagerGroup) { - // look around to see if there's an enabled and visible - // selected member in the tabgroup, otherwise use the first - // one we found. + + // when landing on an element that is part of group, try to + // advance selection to the selected group element + var j:int; + var obj:DisplayObject; var tg1:IFocusManagerGroup = IFocusManagerGroup(o); - for (var j:int = 0; j < focusableCandidates.length; j++) + var tg2:IFocusManagerGroup; + + // normalize the "no selected group element" case + // to the "first group element selected" case + // (respecting the tab direction) + var groupElementToFocus:IFocusManagerGroup = null; + for (j = 0; j < focusableCandidates.length; j++) { - var obj:DisplayObject = focusableCandidates[j]; - if (obj is IFocusManagerGroup && isEnabledAndVisible(obj)) + obj = focusableCandidates[j]; + if (obj is IFocusManagerGroup) { - var tg2:IFocusManagerGroup = IFocusManagerGroup(obj); - if (tg2.groupName == tg1.groupName && tg2.selected) + tg2 = IFocusManagerGroup(obj); + if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj)) { - // if objects of same group have different tab index - // skip you aren't selected. - if (InteractiveObject(obj).tabIndex != InteractiveObject(o).tabIndex && !tg1.selected) - return getIndexOfNextObject(i, shiftKey, bSearchAll, groupName); - - i = j; - break; + if (tg2.selected) + { + groupElementToFocus = tg2; + break; + } + if ((!shiftKey && groupElementToFocus == null) || shiftKey) + groupElementToFocus = tg2; + } + } + } + + if (tg1 != groupElementToFocus) + { + // cycle the entire focusable candidates array forward or backward, + // wrapping around boundaries, searching for our focus candidate + j = i; + for (var k:int = 0; k < focusableCandidates.length - 1; k++) + { + + if (!shiftKey) + { + j++; + if (j == focusableCandidates.length) + j = 0; + } + else + { + j--; + if (j == -1) + j = focusableCandidates.length - 1; + } + + obj = focusableCandidates[j]; + if (isEnabledAndVisible(obj)) + { + if (obj is IFocusManagerGroup) + { + tg2 = IFocusManagerGroup(obj); + if (tg2.groupName == tg1.groupName) + { + if (tg2 == groupElementToFocus) + { + // if objects of same group have different tab index + // skip you aren't selected. + if (InteractiveObject(obj).tabIndex != InteractiveObject(o).tabIndex && !tg1.selected) + return getIndexOfNextObject(i, shiftKey, bSearchAll, groupName); + i = j; + break; + } + } + else + { + // element is part of another group, stop (no recursive search) + i = j; + break; + } + } + else + { + // element isn't part of any group, stop + i = j; + break; + } } } } - } return i; }