Bug 1252857 - Value change events for HTML:select have wrong target. r=marcoz, a=ritu
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1242,22 +1242,16 @@ DocAccessible::GetAccessibleOrContainer(
// Fallback to just get parent node, in case there is no parent content
// node. Or current node is not a content node.
if (!parent)
parent = currNode->GetParentNode();
if (!(currNode = parent)) break;
}
- // HTML comboboxes have no-content list accessible as an intermediate
- // containing all options.
- if (accessible && accessible->IsHTMLCombobox()) {
- return accessible->FirstChild();
- }
-
return accessible;
}
Accessible*
DocAccessible::GetAccessibleOrDescendant(nsINode* aNode) const
{
Accessible* acc = GetAccessible(aNode);
if (acc)
@@ -1696,16 +1690,22 @@ DocAccessible::ProcessContentInserted(Ac
// If new root content has been inserted then update it.
UpdateRootElIfNeeded();
// Continue to update the tree even if we don't have root content.
// For example, elements may be inserted under the document element while
// there is no HTML body element.
}
+ // HTML comboboxes have no-content list accessible as an intermediate
+ // containing all options.
+ if (container && container->IsHTMLCombobox()) {
+ container = container->FirstChild();
+ }
+
// We have a DOM/layout change under the container accessible, and its tree
// might need an update. Since DOM/layout change of the element may affect
// on the accessibleness of adjacent elements (for example, insertion of
// extra HTML:body make the old body accessible) then we have to recache
// children of the container, and then fire show/hide events for a change.
UpdateTreeOnInsertion(container);
break;
}
--- a/accessible/tests/mochitest/events/test_valuechange.html
+++ b/accessible/tests/mochitest/events/test_valuechange.html
@@ -127,17 +127,18 @@
this.getID = function changeRangeValue_getID()
{
return prettyName(aID) + " range value changed";
}
}
function changeSelectValue(aID, aKey, aValue)
{
- this.eventSeq = [new invokerChecker(EVENT_TEXT_VALUE_CHANGE, aID)];
+ this.eventSeq =
+ [ new invokerChecker(EVENT_TEXT_VALUE_CHANGE, getAccessible(aID)) ];
this.invoke = function changeSelectValue_invoke()
{
getNode(aID).focus();
synthesizeKey(aKey, {}, window);
}
this.finalCheck = function changeSelectValue_finalCheck()