Bug 455482 - In a select nested within a label, the accname contains each option's text, should only contain label's text, patch=Eitan, r=me, marcoz

This commit is contained in:
Alexander Surkov 2008-10-29 16:53:43 +08:00
parent d9a06e8869
commit 9138981c0f
2 changed files with 24 additions and 2 deletions

View File

@ -1624,11 +1624,16 @@ nsAccessible::AppendFlatStringFromSubtreeRecurse(nsIContent *aContent,
// Append all the text into one flat string
PRUint32 numChildren = 0;
nsCOMPtr<nsIDOMXULSelectControlElement> selectControlEl(do_QueryInterface(aContent));
if (!selectControlEl && aContent->Tag() != nsAccessibilityAtoms::textarea) {
nsCOMPtr<nsIAtom> tag = aContent->Tag();
if (!selectControlEl &&
tag != nsAccessibilityAtoms::textarea &&
tag != nsAccessibilityAtoms::select) {
// Don't walk children of elements with options, just get label directly.
// Don't traverse the children of a textarea, we want the value, not the
// static text node.
// Don't traverse the children of a select element, we only want the
// current value.
numChildren = aContent->GetChildCount();
}

View File

@ -128,6 +128,11 @@
testName("textareawithchild", "Story: Bar");
/////////////////////////////////////////////////////////////////////////
// label with nested combobox
testName("comboinmiddle", "Subscribe to ATOM feed.");
SimpleTest.finish();
}
@ -281,5 +286,17 @@
</label>
</form>
<!-- A label with a nested control in the middle -->
<form>
<label id="comboinmiddle">
Subscribe to
<select id="combo3" name="occupation">
<option>ATOM</option>
<option>RSS</option>
</select>
feed.
</label>
</form>
</body>
</html>