Bug 758675 - Speak accessible description if available, r=eeejay, f=yzen

This commit is contained in:
Marco Zehe 2013-07-23 10:40:49 +02:00
parent 510c284680
commit 76eb402be0
2 changed files with 37 additions and 0 deletions

View File

@ -164,6 +164,19 @@ this.OutputGenerator = {
name = aAccessible.name;
}
let description = aAccessible.description;
if (description) {
// Compare against the calculated name unconditionally, regardless of name rule,
// so we can make sure we don't speak duplicated descriptions
let tmpName = name || aAccessible.name;
if (tmpName && (description !== tmpName)) {
name = name || '';
name = this.outputOrder === OUTPUT_DESC_FIRST ?
description + ' - ' + name :
name + ' - ' + description;
}
}
if (name) {
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ?
'push' : 'unshift'](name);

View File

@ -23,6 +23,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
var tests = [{
accOrElmOrID: "anchor",
expected: [["link", "title"], ["title", "link"]]
}, {
accOrElmOrID: "anchor_titleandtext",
expected: [[
"link", "goes to the tests -", "Tests"
], [
"Tests", "- goes to the tests", "link"
]]
}, {
accOrElmOrID: "anchor_duplicatedtitleandtext",
expected: [["link", "Tests"], ["Tests", "link"]]
}, {
accOrElmOrID: "anchor_arialabelandtext",
expected: [[
"link", "goes to the tests - Tests"
], [
"Tests - goes to the tests", "link"
]]
}, {
accOrElmOrID: "textarea",
expected: [[
@ -142,10 +159,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
href="https://bugzilla.mozilla.org/show_bug.cgi?id=753984"
title="[AccessFu] utterance order test">
Mozilla Bug 753984</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=758675"
title="[AccessFu] Add support for accDescription">
Mozilla Bug 758675</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<a id="anchor" href="#test" title="title"></a>
<a id="anchor_titleandtext" href="#test" title="goes to the tests">Tests</a>
<a id="anchor_duplicatedtitleandtext" href="#test" title="Tests">Tests</a>
<a id="anchor_arialabelandtext" href="#test" aria-label="Tests" title="goes to the tests">Tests</a>
<textarea id="textarea" cols="80" rows="5">
This is the text area text.
</textarea>