From 816ddd774494f3f76753cac9b5d3ae17d6ee6cee Mon Sep 17 00:00:00 2001 From: "gijskruitbosch@gmail.com" Date: Sat, 29 Mar 2008 15:04:04 -0700 Subject: [PATCH] Bug 425213 - FOCUSABLE state not exposed for descendants of container with aria-activedescendant p=aaronleventhal@moonset.net (Aaron Leventhal) r=surkov.alexander@gmail.com (Alexander Surkov) a=beltzner@mozilla.com (Mike Beltzner) --- accessible/src/base/nsAccessibilityService.cpp | 3 +-- accessible/src/base/nsAccessible.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index aa11df3b7926..caad1c487adf 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -1284,9 +1284,8 @@ static PRBool HasRelatedContent(nsIContent *aContent) } nsIContent *ancestorContent = aContent; - nsAutoString activeID; while ((ancestorContent = ancestorContent->GetParent()) != nsnull) { - if (ancestorContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant, activeID)) { + if (ancestorContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant)) { // ancestor has activedescendant property, this content could be active return PR_TRUE; } diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 8b0c3a1617dc..23e111b99bbc 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -2430,6 +2430,18 @@ nsAccessible::GetARIAState(PRUint32 *aState) // Once DHTML role is used, we're only readonly if DHTML readonly used *aState &= ~nsIAccessibleStates::STATE_READONLY; + if (content->HasAttr(kNameSpaceID_None, content->GetIDAttributeName())) { + // If has a role & ID and aria-activedescendant on the container, assume focusable + nsIContent *ancestorContent = content; + while ((ancestorContent = ancestorContent->GetParent()) != nsnull) { + if (ancestorContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant)) { + // ancestor has activedescendant property, this content could be active + *aState |= nsIAccessibleStates::STATE_FOCUSABLE; + break; + } + } + } + *aState |= mRoleMapEntry->state; if (MappedAttrState(content, aState, &mRoleMapEntry->attributeMap1) && MappedAttrState(content, aState, &mRoleMapEntry->attributeMap2) &&