diff --git a/accessible/src/jsat/OutputGenerator.jsm b/accessible/src/jsat/OutputGenerator.jsm index 673099eae70e..e917fc365a03 100644 --- a/accessible/src/jsat/OutputGenerator.jsm +++ b/accessible/src/jsat/OutputGenerator.jsm @@ -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); diff --git a/accessible/tests/mochitest/jsat/test_utterance_order.html b/accessible/tests/mochitest/jsat/test_utterance_order.html index 3d26ef9d6b0b..b197521277ad 100644 --- a/accessible/tests/mochitest/jsat/test_utterance_order.html +++ b/accessible/tests/mochitest/jsat/test_utterance_order.html @@ -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 + + Mozilla Bug 758675


       
+      Tests
+      Tests
+      Tests