diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index a2fc23b72e8..c54b243afc1 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -226,11 +226,7 @@ void nsLinkableAccessible::CacheActionContent() for (nsCOMPtr walkUpContent(do_QueryInterface(mDOMNode)); walkUpContent; walkUpContent = walkUpContent->GetParent()) { - if (nsAccUtils::HasListener(walkUpContent, NS_LITERAL_STRING("click"))) { - mActionContent = walkUpContent; - mIsOnclick = PR_TRUE; - break; - } + PRBool isOnclick = nsAccUtils::HasListener(walkUpContent, NS_LITERAL_STRING("click")); nsIAtom *tag = walkUpContent->Tag(); if ((tag == nsAccessibilityAtoms::a || tag == nsAccessibilityAtoms::area) && walkUpContent->IsNodeOfType(nsINode::eHTML)) { @@ -252,9 +248,15 @@ void nsLinkableAccessible::CacheActionContent() // Don't let it keep walking up, otherwise we may report the wrong container // as the action node mActionContent = walkUpContent; + mIsOnclick = isOnclick; break; } } + if (isOnclick) { + mActionContent = walkUpContent; + mIsOnclick = PR_TRUE; + break; + } } }