Bug 786163 - sort out name calculation for HTML input buttons, r=tbsaunde

This commit is contained in:
Alexander Surkov 2013-02-03 13:49:18 +09:00
parent fdea80851b
commit de568aceea
8 changed files with 261 additions and 294 deletions

View File

@ -259,26 +259,23 @@ HTMLButtonAccessible::NativeRole()
ENameValueFlag
HTMLButtonAccessible::NativeName(nsString& aName)
{
// No need to check @value attribute for buttons since this attribute results
// in native anonymous text node and the name is calculated from subtree.
// The same magic works for @alt and @value attributes in case of type="image"
// element that has no valid @src (note if input@type="image" has an image
// then neither @alt nor @value attributes are used to generate a visual label
// and thus we need to obtain the accessible name directly from attribute
// value). Also the same algorithm works in case of default labels for
// type="submit"/"reset"/"image" elements.
ENameValueFlag nameFlag = Accessible::NativeName(aName);
if (!aName.IsEmpty() || mContent->Tag() != nsGkAtoms::input)
if (!aName.IsEmpty() || mContent->Tag() != nsGkAtoms::input ||
!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::image, eCaseMatters))
return nameFlag;
// Note: No need to check @value attribute since it results in anonymous text
// node. The name is calculated from subtree in this case.
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName)) {
// Use the button's (default) label if nothing else works
nsIFrame* frame = GetFrame();
if (frame) {
nsIFormControlFrame* fcFrame = do_QueryFrame(frame);
if (fcFrame)
fcFrame->GetFormProperty(nsGkAtoms::defaultLabel, aName);
}
}
if (aName.IsEmpty() &&
!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, aName)) {
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, aName);
}
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
aName.CompressWhitespace();
return eNameOK;

View File

@ -68,18 +68,22 @@ var gA11yEventDumpFeature = "";
* @param aArg1 [in, optional] argument passed into the function
* @param aArg2 [in, optional] argument passed into the function
*/
function waitForEvent(aEventType, aTarget, aFunc, aContext, aArg1, aArg2)
function waitForEvent(aEventType, aTargetOrFunc, aFunc, aContext, aArg1, aArg2)
{
var handler = {
handleEvent: function handleEvent(aEvent) {
if (aTarget) {
if (aTarget instanceof nsIAccessible &&
aTarget != aEvent.accessible)
var target = aTargetOrFunc;
if (typeof aTargetOrFunc == "function")
target = aTargetOrFunc.call();
if (target) {
if (target instanceof nsIAccessible &&
target != aEvent.accessible)
return;
if (aTarget instanceof nsIDOMNode &&
aTarget != aEvent.DOMNode)
if (target instanceof nsIDOMNode &&
target != aEvent.DOMNode)
return;
}

View File

@ -15,7 +15,6 @@ MOCHITEST_A11Y_FILES =\
general.css \
general.xbl \
markup.js \
test_button.html \
test_general.html \
test_general.xul \
test_link.html \

View File

@ -41,11 +41,15 @@ var gTestIterator =
this.iterateNext();
},
iterateRules: function gTestIterator_iterateRules(aElm, aContainer, aRuleElms)
iterateRules: function gTestIterator_iterateRules(aElm, aContainer,
aRuleSetElm, aRuleElms,
aTestID)
{
this.ruleSetElm = aRuleSetElm;
this.ruleElms = aRuleElms;
this.elm = aElm;
this.container = aContainer;
this.testID = aTestID;
this.iterateNext();
},
@ -61,7 +65,10 @@ var gTestIterator =
this.ruleIdx++;
if (this.ruleIdx == this.ruleElms.length) {
// When test is finished then name is empty and no explict-name.
testName(this.elm, null, "No name test. ");
var defaultName = this.ruleSetElm.hasAttribute("defaultName") ?
this.ruleSetElm.getAttribute("defaultName") : null;
testName(this.elm, defaultName,
"Default name test (" + gTestIterator.testID + "). ");
testAbsentAttrs(this.elm, {"explicit-name" : "true"});
this.markupIdx++;
@ -89,10 +96,12 @@ var gTestIterator =
markupElms: null,
markupIdx: -1,
rulesetElm: null,
ruleElms: null,
ruleIdx: -1,
elm: null,
container: null
container: null,
testID: ""
};
/**
@ -126,8 +135,9 @@ function testNamesForMarkup(aMarkupElm)
function testNamesForMarkupRules(aMarkupElm, aContainer)
{
var testID = aMarkupElm.getAttribute("id");
if (gDumpToConsole)
dump("\nProcessing markup rules '" + aMarkupElm.getAttribute("id") + "'\n");
dump("\nProcessing markup rules '" + testID + "'\n");
var serializer = new XMLSerializer();
@ -135,14 +145,17 @@ function testNamesForMarkupRules(aMarkupElm, aContainer)
var elm = evaluateXPath(document, expr, htmlDocResolver)[0];
var ruleId = aMarkupElm.getAttribute("ruleset");
var ruleElm = gRuleDoc.querySelector("[id='" + ruleId + "']");
var ruleElms = getRuleElmsByRulesetId(ruleId);
var processMarkupRules =
gTestIterator.iterateRules.bind(gTestIterator, elm, aContainer, ruleElms);
gTestIterator.iterateRules.bind(gTestIterator, elm, aContainer,
ruleElm, ruleElms, testID);
// Images may be recreated after we append them into subtree. We need to wait
// in this case. If we are on profiling enabled build then stack tracing
// works and thus let's log instead.
// works and thus let's log instead. Note, that works if you enabled logging
// (refer to testNames() function).
if (isAccessible(elm) || isLogged("stack"))
processMarkupRules();
else
@ -198,20 +211,40 @@ function testNameForAttrRule(aElm, aRule)
if (name != "")
name += " ";
name += labelElm.getAttribute("a11yname");
name += labelElm.getAttribute("textequiv");
}
}
var msg = "Attribute '" + attr + "' test. ";
var msg = "Attribute '" + attr + "' test (" + gTestIterator.testID + "). ";
testName(aElm, name, msg);
if (aRule.getAttribute("explict-name") != "false")
testAttrs(aElm, {"explicit-name" : "true"}, true);
else
testAbsentAttrs(aElm, {"explicit-name" : "true"});
aElm.removeAttribute(attr);
// If @recreated attribute is used then this attribute change recreates an
// accessible. Wait for reorder event in this case or otherwise proceed next
// test immediately.
if (aRule.hasAttribute("recreated")) {
waitForEvent(EVENT_REORDER, aElm.parentNode,
gTestIterator.iterateNext, gTestIterator);
aElm.removeAttribute(attr);
gTestIterator.iterateNext();
} else if (aRule.hasAttribute("textchanged")) {
waitForEvent(EVENT_TEXT_INSERTED, aElm,
gTestIterator.iterateNext, gTestIterator);
aElm.removeAttribute(attr);
} else if (aRule.hasAttribute("contentchanged")) {
waitForEvent(EVENT_REORDER, aElm,
gTestIterator.iterateNext, gTestIterator);
aElm.removeAttribute(attr);
} else {
aElm.removeAttribute(attr);
gTestIterator.iterateNext();
}
}
function testNameForElmRule(aElm, aRule)
@ -254,8 +287,8 @@ function testNameForElmRule(aElm, aRule)
return;
}
var msg = "Element '" + tagname + "' test.";
testName(aElm, labelElm.getAttribute("a11yname"), msg);
var msg = "Element '" + tagname + "' test (" + gTestIterator.testID + ").";
testName(aElm, labelElm.getAttribute("textequiv"), msg);
testAttrs(aElm, {"explicit-name" : "true"}, true);
var parentNode = labelElm.parentNode;
@ -272,8 +305,8 @@ function testNameForElmRule(aElm, aRule)
function testNameForSubtreeRule(aElm, aRule)
{
var msg = "From subtree test.";
testName(aElm, aElm.getAttribute("a11yname"), msg);
var msg = "From subtree test (" + gTestIterator.testID + ").";
testName(aElm, aElm.getAttribute("textequiv"), msg);
testAbsentAttrs(aElm, {"explicit-name" : "true"});
if (gDumpToConsole) {

View File

@ -63,7 +63,7 @@
</ruledfn>
<rulesample>
<markup ref="html:div" ruleset="aria">
<html:span id="label" a11yname="test2">test2</html:span>
<html:span id="label" textequiv="test2">test2</html:span>
<html:div aria-label="test1"
aria-labelledby="label">it's a div</html:div>
</markup>
@ -76,7 +76,7 @@
Then we check accessible name for the test element and remove 'aria-label'
attribute. After we get the second rule which means we should get IDs from
'aria-labelledby' attribute and compose accessible name from values of
'a11yname' attributes (that are supposed to give the desired name for each
'textequiv' attributes (that are supposed to give the desired name for each
element that is being pointed to by aria-labelledby). Check accessible name
and finish test.
-->
@ -87,125 +87,198 @@
<ruledfn>
<!-- bricks -->
<ruleset id="aria">
<ruleset id="ARIA">
<rule attr="aria-labelledby" type="ref"/>
<rule attr="aria-label" type="string"/>
</ruleset>
<ruleset id="htmlctrl_start">
<ruleset ref="aria"/>
<ruleset id="HTMLElm:Head">
<ruleset ref="ARIA"/>
<rule elm="label" elmattr="for"/>
<rule fromsubtree="true"/>
</ruleset>
<ruleset id="htmlctrl_end">
<rule attr="title" type="string"/>
</ruleset>
<ruleset id="htmlelm_start">
<ruleset ref="aria"/>
<rule elm="label" elmattr="for"/>
</ruleset>
<ruleset id="htmlelm_end">
<rule attr="title" type="string"/>
</ruleset>
<!-- general -->
<ruleset id="htmlctrl">
<ruleset ref="htmlctrl_start"/>
<ruleset ref="htmlctrl_end"/>
<ruleset id="HTMLControl">
<ruleset ref="ARIA"/>
<rule elm="label" elmattr="for"/>
<rule fromsubtree="true"/>
<rule attr="title" type="string"/>
</ruleset>
<ruleset id="htmlelm">
<ruleset ref="htmlelm_start"/>
<ruleset ref="htmlelm_end"/>
<ruleset id="HTMLElm">
<ruleset ref="HTMLElm:Head"/>
<rule attr="title" type="string"/>
</ruleset>
<!-- specific -->
<ruleset id="htmlinputbutton">
<ruleset ref="htmlelm_start"/>
<rule attr="value" type="string" explict-name="false"/>
<rule attr="alt" type="string"/>
<rule attr="src" type="string"/>
<rule attr="data" type="string"/>
<ruleset ref="htmlelm_end"/>
<ruleset id="HTMLInputButton">
<ruleset ref="HTMLElm:Head"/>
<rule attr="value" type="string" explict-name="false" reordered="true"/>
<rule attr="title" type="string"/>
</ruleset>
<ruleset id="htmloption">
<ruleset ref="aria"/>
<ruleset id="HTMLInputSubmit" defaultName="Submit Query">
<ruleset ref="HTMLElm:Head"/>
<rule attr="value" type="string" explict-name="false" textchanged="true"/>
</ruleset>
<ruleset id="HTMLInputReset" defaultName="Reset">
<ruleset ref="HTMLElm:Head"/>
<rule attr="value" type="string" explict-name="false" textchanged="true"/>
</ruleset>
<ruleset id="HTMLInputImage">
<ruleset ref="HTMLElm:Head"/>
<rule attr="alt" type="string" recreated="true"/>
<rule attr="value" type="string" recreated="true"/>
<rule attr="title" type="string"/>
</ruleset>
<ruleset id="HTMLInputImageNoValidSrc" defaultName="Submit Query">
<ruleset ref="HTMLElm:Head"/>
<rule attr="alt" type="string" explict-name="false" recreated="true"/>
<rule attr="value" type="string" explict-name="false" recreated="true"/>
</ruleset>
<ruleset id="HTMLOption">
<ruleset ref="ARIA"/>
<rule attr="label" type="string"/>
<rule fromsubtree="true"/>
<rule attr="title" type="string"/>
</ruleset>
<ruleset id="htmlimage">
<ruleset ref="aria"/>
<ruleset id="HTMLImg">
<ruleset ref="ARIA"/>
<rule attr="alt" type="string"/>
<ruleset ref="htmlelm_end"/>
<rule attr="title" type="string"/>
</ruleset>
<ruleset id="htmlimageemptyalt">
<ruleset ref="aria"/>
<ruleset ref="htmlelm_end"/>
<ruleset id="HTMLImgEmptyAlt">
<ruleset ref="ARIA"/>
<rule attr="title" type="string"/>
<rule attr="alt" type="string"/>
</ruleset>
<ruleset id="htmltable">
<ruleset ref="htmlelm_start"/>
<ruleset id="HTMLTable">
<ruleset ref="HTMLElm:Head"/>
<rule elm="caption"/>
<rule attr="summary" type="string"/>
<ruleset ref="htmlelm_end"/>
<rule attr="title" type="string"/>
</ruleset>
</ruledfn>
<rulesample>
<markup ref="html:button" ruleset="htmlctrl" id="markup1test">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<html:label for="btn" a11yname="test4">test4</html:label>
<markup id="HTMLButtonTest"
ref="html:button" ruleset="HTMLControl">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="btn" textequiv="test4">test4</html:label>
<html:button id="btn"
aria-label="test1"
aria-labelledby="l1 l2"
title="test5"
a11yname="press me">press me</html:button>
textequiv="press me">press me</html:button>
</markup>
<markup ref="html:input" ruleset="htmlinputbutton" id="markup2test">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<html:label for="btn" a11yname="test4">test4</html:label>
<markup id="HTMLInputButtonTest"
ref="html:input" ruleset="HTMLInputButton">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="btn" textequiv="test4">test4</html:label>
<html:input id="btn"
type="button"
aria-label="test1"
aria-labelledby="l1 l2"
value="test5"
alt="test6"
src="test7"
data="test8"
title="test9"/>
value="name from value"
alt="no name from al"
src="no name from src"
data="no name from data"
title="name from title"/>
</markup>
<markup ref="html:select/html:option[1]" ruleset="htmloption"
id="markup3test">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<markup id="HTMLInputSubmitTest"
ref="html:input" ruleset="HTMLInputSubmit">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="btn-submit" textequiv="test4">test4</html:label>
<html:input id="btn-submit"
type="submit"
aria-label="test1"
aria-labelledby="l1 l2"
value="name from value"
alt="no name from atl"
src="no name from src"
data="no name from data"
title="no name from title"/>
</markup>
<markup id="HTMLInputResetTest"
ref="html:input" ruleset="HTMLInputReset">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="btn-reset" textequiv="test4">test4</html:label>
<html:input id="btn-reset"
type="reset"
aria-label="test1"
aria-labelledby="l1 l2"
value="name from value"
alt="no name from alt"
src="no name from src"
data="no name from data"
title="no name from title"/>
</markup>
<markup id="HTMLInputImageTest"
ref="html:input" ruleset="HTMLInputImage">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="btn-image" textequiv="test4">test4</html:label>
<html:input id="btn-image"
type="image"
aria-label="test1"
aria-labelledby="l1 l2"
alt="name from alt"
value="name from value"
src="../moz.png"
data="no name from data"
title="name from title"/>
</markup>
<markup id="HTMLInputImageNoValidSrcTest"
ref="html:input" ruleset="HTMLInputImageNoValidSrc">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="btn-image" textequiv="test4">test4</html:label>
<html:input id="btn-image"
type="image"
aria-label="test1"
aria-labelledby="l1 l2"
alt="name from alt"
value="name from value"
data="no name from data"
title="no name from title"/>
</markup>
<markup id="HTMLOptionTest"
ref="html:select/html:option[1]" ruleset="HTMLOption">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:select>
<html:option id="opt"
aria-label="test1"
aria-labelledby="l1 l2"
label="test4"
title="test5"
a11yname="option1">option1</html:option>
textequiv="option1">option1</html:option>
<html:option>option2</html:option>
</html:select>
</markup>
<markup ref="html:img" ruleset="htmlimage"
id="markupHTMLImageTest">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<markup id="HTMLImageTest"
ref="html:img" ruleset="HTMLImg">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:img id="img"
aria-label="Logo of Mozilla"
aria-labelledby="l1 l2"
@ -214,10 +287,10 @@
src="../moz.png"/>
</markup>
<markup ref="html:img" ruleset="htmlimageemptyalt">
id="markupHTMLImageEmptyAltTest"
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<markup id="HTMLImageEmptyAltTest"
ref="html:img" ruleset="HTMLImgEmptyAlt">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:img id="imgemptyalt"
aria-label="Logo of Mozilla"
aria-labelledby="l1 l2"
@ -226,11 +299,11 @@
src="../moz.png"/>
</markup>
<markup ref="html:table/html:tr/html:td" ruleset="htmlelm"
id="markup4test">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<html:label for="tc" a11yname="test4">test4</html:label>
<markup id="HTMLTdTest"
ref="html:table/html:tr/html:td" ruleset="HTMLElm">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="tc" textequiv="test4">test4</html:label>
<html:table>
<html:tr>
<html:td id="tc"
@ -247,18 +320,18 @@
</html:table>
</markup>
<markup ref="html:table/html:tr/html:td" ruleset="htmlctrl"
id="markup5test">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
<html:label for="gc" a11yname="test4">test4</html:label>
<markup id="HTMLTdARIAGridCellTest"
ref="html:table/html:tr/html:td" ruleset="HTMLControl">
<html:span id="l1" textequiv="test2">test2</html:span>
<html:span id="l2" textequiv="test3">test3</html:span>
<html:label for="gc" textequiv="test4">test4</html:label>
<html:table>
<html:tr>
<html:td id="gc"
role="gridcell"
aria-label="test1"
aria-labelledby="l1 l2"
a11yname="This is a paragraph This is a link • Listitem1 • Listitem2"
textequiv="This is a paragraph This is a link • Listitem1 • Listitem2"
title="This is a paragraph This is a link This is a list">
<html:p>This is a paragraph</html:p>
<html:a href="#">This is a link</html:a>
@ -271,11 +344,11 @@
</html:table>
</markup>
<markup ref="html:table" ruleset="htmltable"
id="markup6test">
<html:span id="l1" a11yname="lby_tst6_1">lby_tst6_1</html:span>
<html:span id="l2" a11yname="lby_tst6_2">lby_tst6_2</html:span>
<html:label for="t" a11yname="label_tst6">label_tst6</html:label>
<markup id="HTMLTableTest"
ref="html:table" ruleset="HTMLTable">
<html:span id="l1" textequiv="lby_tst6_1">lby_tst6_1</html:span>
<html:span id="l2" textequiv="lby_tst6_2">lby_tst6_2</html:span>
<html:label for="t" textequiv="label_tst6">label_tst6</html:label>
<!-- layout frame are recreated due to varous reasons, here's text frame
placed after caption frame triggres table frame recreation when
caption element is removed from DOM; get rid text node after caption
@ -284,7 +357,7 @@
aria-labelledby="l1 l2"
summary="summary_tst6"
title="title_tst6">
<html:caption a11yname="caption_tst6">caption_tst6</html:caption><html:tr>
<html:caption textequiv="caption_tst6">caption_tst6</html:caption><html:tr>
<html:td>cell1</html:td>
<html:td>cell2</html:td>
</html:tr>

View File

@ -1,145 +0,0 @@
<html>
<head>
<title>nsIAccessible::name calculation for HTML buttons</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
// html:button, aria-label
testName("btn_aria_label", "button label");
// html:button, aria-labelledby
testName("btn_aria_labelledby_text", "text");
// html:button, html:label
testName("btn_labelled", "label");
// html:button, name from content
testName("btn_namefromcontent", "1");
// html:button, no name from content
testName("btn_nonamefromcontent", null);
// @html:button, title
testName("btn_title", "title");
// html:input, aria-label
testName("input_aria_label", "button label");
// html:input, aria-labelledby
testName("input_aria_labelledby_text", "text");
// html:input, html:label
testName("input_labelled", "label");
// html:input, @value
testName("input_value0", "1");
// html:input, @value
testName("input_value", "1");
// html:input, @alt
testName("input_alt", "alt");
// html:input, @src
testName("input_src", "src");
// html:input, @data
testName("input_data", "data");
// html:input, @title
testName("input_title", "title");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=459635"
title="nsIAccessible::name calculation for HTML buttons">
Mozilla Bug 459635
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- aria-labelledby preferred to aria-label -->
<button id="btn_aria_label"
aria-label="button label">1</button>
<br/>
<!-- button, aria-labelledby, preferred to html:label -->
<span id="aria_labelledby_text">text</span>
<label for="btn_aria_labelledby_text">label</label>
<button id="btn_aria_labelledby_text"
aria-labelledby="aria_labelledby_text">1</button>
<br/>
<!-- button, label, preferred to name from content -->
<label for="btn_labelled">label</label>
<button id="btn_labelled">1</button>
<!-- button, name from content, preferred to @title -->
<button id="btn_namefromcontent" title="title">1</button>
<!-- button, no name from content, ARIA role overrides this rule -->
<button id="btn_nonamefromcontent" role="img">1</button>
<!-- button, no content, name from @title -->
<button id="btn_title" title="title"></button>
<!-- input, aria-label -->
<input type="button" id="input_aria_label"
aria-label="button label"
value="1"/>
<br/>
<!-- aria-labelledby, preferred to html:label -->
<span id="aria_labelledby_text_for_input">text</span>
<label for="input_aria_labelledby_text">label</label>
<input type="button" id="input_aria_labelledby_text"
aria-labelledby="aria_labelledby_text_for_input"
value="1"/>
<br/>
<!-- label, preferred to @title -->
<label for="input_labelled">label</label>
<input type="button" id="input_labelled" value="1" title="title"/>
<!-- name from @value, preferred to @title -->
<input type="button" id="input_value0" title="title" value="1"/>
<!-- name from @value, preferred to @alt -->
<input type="button" id="input_value" value="1" alt="alt"/>
<!-- name from @alt, preferred to @src -->
<input type="button" id="input_alt" alt="alt" @src="src"/>
<!-- name from @src, preferred to @data -->
<input type="button" id="input_src" src="src" data="data"/>
<!-- name from @data -->
<input type="button" id="input_data" data="data"/>
<!-- name from @title -->
<input type="button" id="input_title" title="title"/>
</body>
</html>

View File

@ -125,6 +125,9 @@
// children.
testName("btn_children", "14");
// html:button, no name from content
testName("btn_nonamefromcontent", null);
// ARIA role option is presented allowing the name calculation from
// visible children (bug 443081).
testName("lb_opt1_children_hidden", "i am visible");
@ -158,12 +161,6 @@
testName("textareawithchild", "Story Bar is ended.");
//////////////////////////////////////////////////////////////////////////
// button name (specific cases not covered by test_name_markup.html)
testName("submit", "Submit Query");
testName("image_submit", "Submit Query");
//////////////////////////////////////////////////////////////////////////
// controls having a value used as a part of computed name
@ -223,42 +220,47 @@
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=428479"
title="Bug 428479 - Support ARIA role=math">
Mozilla Bug 428479
</a><br>
Bug 428479
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=429666"
title="Expose ROLE_DOCUMENT for ARIA landmarks that inherit from document">
Mozilla Bug 429666
</a><br>
Bug 429666
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=444279"
title="mochitest for accessible name calculating">
Mozilla Bug 444279
</a><br>
Bug 444279
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=459635"
title="nsIAccessible::name calculation for HTML buttons">
Bug 459635
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=530081"
title="Clean up our tree walker ">
Mozilla Bug 530081
title="Clean up our tree walker">
Bug 530081
</a><br>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=604391"
title="Use placeholder as name if name is otherwise empty">
Mozilla Bug 604391
Bug 604391
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=669312"
title="Accessible name is duplicated when input has a label associated uisng for/id and is wrapped around the input">
Mozilla Bug 669312
Bug 669312
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=704416"
title="HTML acronym and abbr names should be provided by @title">
Mozilla Bug 704416
Bug 704416
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=812041"
title="ARIA slider and spinbutton don't provide a value for name computation">
Mozilla Bug 812041
Bug 812041
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -418,6 +420,9 @@
<!-- name from children -->
<span id="btn_children" role="button">14</span>
<!-- no name from content, ARIA role overrides this rule -->
<button id="btn_nonamefromcontent" role="img">1</button>
<!-- name from children, hidden children -->
<div role="listbox" tabindex="0">
<div id="lb_opt1_children_hidden" role="option" tabindex="0">
@ -455,10 +460,6 @@
</label>
</form>
<!-- submit buttons -->
<input type="submit" id="submit">
<input type="image" id="image_submit">
<!-- controls having a value used as part of computed name -->
<input type="checkbox" id="ctrlvalue_progressbar:input">
<label for="ctrlvalue_progressbar:input">

View File

@ -37,12 +37,17 @@
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=459635"
title="nsIAccessible::name calculation for elements">
Mozilla Bug 459635
Bug 459635
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=666212"
title="summary attribute content mapped to accessible name in MSAA">
Mozilla Bug 666212
Bug 666212
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=786163"
title=" Sort out name calculation for HTML input buttons">
Bug 786163
</a>
<p id="display"></p>