diff --git a/accessible/src/xul/nsXULFormControlAccessible.cpp b/accessible/src/xul/nsXULFormControlAccessible.cpp index 6d3806512a4..ed7211c9a7a 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.cpp +++ b/accessible/src/xul/nsXULFormControlAccessible.cpp @@ -498,8 +498,19 @@ NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccState(PRUint32 *_retval) if (radioButton) radioButton->GetSelected(&selected); - if (selected) + if (selected) { *_retval |= STATE_CHECKED; + // If our parent radio group is focused, then consider this radio button focused + nsCOMPtr parentNode; + mDOMNode->GetParentNode(getter_AddRefs(parentNode)); + nsCOMPtr parentElement(do_QueryInterface(parentNode)); + if (parentElement) { + nsCOMPtr focusedElement; + GetFocusedElement(getter_AddRefs(focusedElement)); + if (focusedElement == parentElement) + *_retval |= STATE_FOCUSED; + } + } return NS_OK; } @@ -537,6 +548,21 @@ nsAccessible(aNode, aShell) { } +NS_IMETHODIMP nsXULRadioGroupAccessible::GetAccRole(PRUint32 *_retval) +{ + *_retval = ROLE_GROUPING; + return NS_OK; +} + +NS_IMETHODIMP nsXULRadioGroupAccessible::GetAccState(PRUint32 *_retval) +{ + // The radio group is not focusable. + // Sometimes the focus controller will report that it is focused. + // That means that the actual selected radio button should be considered focused + nsAccessible::GetAccState(_retval); + *_retval &= ~(STATE_FOCUSABLE | STATE_FOCUSED); + return NS_OK; +} /** * XUL StatusBar: can contain arbitrary HTML content */ diff --git a/accessible/src/xul/nsXULFormControlAccessible.h b/accessible/src/xul/nsXULFormControlAccessible.h index 616c089a4ff..bc38dfa598a 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.h +++ b/accessible/src/xul/nsXULFormControlAccessible.h @@ -118,6 +118,8 @@ class nsXULRadioGroupAccessible : public nsAccessible { public: nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell); + NS_IMETHOD GetAccRole(PRUint32 *_retval); + NS_IMETHOD GetAccState(PRUint32 *_retval); }; class nsXULStatusBarAccessible : public nsAccessible