diff --git a/accessible/src/base/nsAccessibilityAtomList.h b/accessible/src/base/nsAccessibilityAtomList.h
index 318632f90cc2..b8d638d42062 100644
--- a/accessible/src/base/nsAccessibilityAtomList.h
+++ b/accessible/src/base/nsAccessibilityAtomList.h
@@ -181,6 +181,7 @@ ACCESSIBILITY_ATOM(minpos, "minpos") // XUL
ACCESSIBILITY_ATOM(multiline, "multiline") // XUL
ACCESSIBILITY_ATOM(name, "name")
ACCESSIBILITY_ATOM(onclick, "onclick")
+ACCESSIBILITY_ATOM(popup, "popup")
ACCESSIBILITY_ATOM(readonly, "readonly")
ACCESSIBILITY_ATOM(scope, "scope") // HTML table
ACCESSIBILITY_ATOM(simple, "simple") // XLink
diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp
index 648deda4d1cb..191813197e96 100644
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -1048,6 +1048,11 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
if (frame && (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
*aState |= nsIAccessibleStates::STATE_FLOATING;
+ // Check if a XUL element has the popup attribute (an attached popup menu).
+ if (content->IsNodeOfType(nsINode::eXUL))
+ if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
+ *aState |= nsIAccessibleStates::STATE_HASPOPUP;
+
// Add 'linked' state for simple xlink.
if (nsCoreUtils::IsXLink(content))
*aState |= nsIAccessibleStates::STATE_LINKED;
@@ -3222,6 +3227,11 @@ nsAccessible::GetActionRule(PRUint32 aStates)
if (nsCoreUtils::IsXLink(content))
return eJumpAction;
+ // Return "click" action on elements that have an attached popup menu.
+ if (content->IsNodeOfType(nsINode::eXUL))
+ if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
+ return eClickAction;
+
// Has registered 'click' event handler.
PRBool isOnclick = nsCoreUtils::HasListener(content,
NS_LITERAL_STRING("click"));
diff --git a/accessible/tests/mochitest/Makefile.in b/accessible/tests/mochitest/Makefile.in
index b1a981fe3989..8921713a0828 100644
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -128,10 +128,11 @@ _TEST_FILES =\
test_role_nsHyperTextAcc.html \
test_role_table_cells.html \
test_states.html \
- test_states_editablebody.html \
test_states_doc.html \
test_states_docarticle.html \
+ test_states_editablebody.html \
test_states_frames.html \
+ test_states_popup.xul \
test_states_tree.xul \
test_table_1.html \
test_table_2.html \
diff --git a/accessible/tests/mochitest/test_actions.xul b/accessible/tests/mochitest/test_actions.xul
index 3c07192a4413..495069cfd90c 100644
--- a/accessible/tests/mochitest/test_actions.xul
+++ b/accessible/tests/mochitest/test_actions.xul
@@ -50,6 +50,11 @@
ID: "buttonmenu",
actionName: "press",
events: CLICK_EVENTS
+ },
+ {
+ ID: "labelWithPopup",
+ actionName: "click",
+ events: CLICK_EVENTS
}/*, // XXX: bug 490288
{
ID: "buttonmenu_item",
@@ -73,6 +78,11 @@
title="nsIAccessible actions testing">
Mozilla Bug 410765
+
+ Mozilla Bug 504252
+
++ + + + +