Bug 924896 - [AccessFu] Exposing the type attribute for entries such as search, url, tel, etc. r=eeejay
☠☠ backed out by 47a9389f5474 ☠ ☠
authorYura Zenevich <yura.zenevich@gmail.com>
Thu, 24 Oct 2013 11:16:23 -0400
changeset 166745 f59777bbd950c1adc90385e95fc03a28b0ffdd98
parent 166744 229a8f20d8ede064aa52a43dfc74b41e421b6156
child 166746 512ee2e8691ecd788ab848630e2ef6f95783ace0
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs924896
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 924896 - [AccessFu] Exposing the type attribute for entries such as search, url, tel, etc. r=eeejay --- accessible/src/jsat/OutputGenerator.jsm | 17 +++++++++++- .../tests/mochitest/jsat/test_utterance_order.html | 27 ++++++++++++++++++++ .../en-US/chrome/accessibility/AccessFu.properties | 6 ++++ 3 files changed, 49 insertions(+), 1 deletions(-)
accessible/src/jsat/OutputGenerator.jsm
accessible/tests/mochitest/jsat/test_utterance_order.html
dom/locales/en-US/chrome/accessibility/AccessFu.properties
--- a/accessible/src/jsat/OutputGenerator.jsm
+++ b/accessible/src/jsat/OutputGenerator.jsm
@@ -199,16 +199,29 @@ this.OutputGenerator = {
     if (!landmark) {
       return;
     }
 
     aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'unshift' : 'push'](
       landmark);
   },
 
+  /**
+   * Adds an entry type attribute to the description if available.
+   * @param {Array} aDesc Description array.
+   * @param {nsIAccessible} aAccessible current accessible object.
+   */
+  _addType: function _addType(aDesc, aAccessible) {
+    let typeName = Utils.getAttributes(aAccessible)['text-input-type'];
+    if (!typeName) {
+      return;
+    }
+    aDesc.push(gStringBundle.GetStringFromName('textInputType_' + typeName));
+  },
+
   get outputOrder() {
     if (!this._utteranceOrder) {
       this._utteranceOrder = new PrefCache('accessibility.accessfu.utterance');
     }
     return typeof this._utteranceOrder.value === 'number' ?
       this._utteranceOrder.value : this.defaultOutputOrder;
   },
 
@@ -301,18 +314,20 @@ this.OutputGenerator = {
 
   objectOutputFunctions: {
     _generateBaseOutput: function _generateBaseOutput(aAccessible, aRoleStr, aStates, aFlags) {
       let output = [];
 
       if (aFlags & INCLUDE_DESC) {
         let desc = this._getLocalizedStates(aStates);
         let roleStr = this._getLocalizedRole(aRoleStr);
-        if (roleStr)
+        if (roleStr) {
+          this._addType(desc, aAccessible);
           desc.push(roleStr);
+        }
         output.push(desc.join(' '));
       }
 
       if (aFlags & INCLUDE_VALUE) {
         let value = aAccessible.value;
         if (value) {
           output[this.outputOrder === OUTPUT_DESC_FIRST ?
                  'push' : 'unshift'](value);
--- a/accessible/tests/mochitest/jsat/test_utterance_order.html
+++ b/accessible/tests/mochitest/jsat/test_utterance_order.html
@@ -79,16 +79,39 @@ https://bugzilla.mozilla.org/show_bug.cg
             "link", "Bananas", "link", "Peaches", "Last item", "link", "Plums"
           ], [
             "Apples", "link", "First item", "Bananas", "link", "Peaches",
             "link", "Plums", "link", "Last item", "list 4 items",
             "Column 1 Row 1", "Fruits and vegetables",
             "table with 1 column and 1 row"
           ]]
         }, {
+          accOrElmOrID: "email",
+          expected: [
+            ["e-mail entry", "test@example.com"],
+            ["test@example.com", "e-mail entry"]
+          ]
+        }, {
+          accOrElmOrID: "search",
+          expected: [
+            ["search entry", "This is a search"],
+            ["This is a search", "search entry"]
+          ]
+        }, {
+          accOrElmOrID: "tel",
+          expected: [
+            ["telephone entry", "555-5555"], ["555-5555", "telephone entry"]
+          ]
+        }, {
+          accOrElmOrID: "url",
+          expected: [
+            ["URL entry", "http://example.com"],
+            ["http://example.com", "URL entry"]
+          ]
+        }, {
           // Test pivot to list from li_one.
           accOrElmOrID: "list",
           oldAccOrElmOrID: "li_one",
           expected: [
             ["list 1 item", "First item", "1.", "list one"],
             ["1.", "list one", "First item", "list 1 item"]
           ]
         }, {
@@ -271,11 +294,15 @@ https://bugzilla.mozilla.org/show_bug.cg
       <form id="form1">
         <label id="label1"><input id="input1" type="checkbox">Orange</label>
         <input id="input2" type="checkbox"><label id="label2" for="input2">Blue</label>
       </form>
       <label id="label3">First name: <input id="input3" value="Joe"></label>
       <label id="label4">Points:
         <input id="input4" type="range" name="points" min="1" max="10" value="3">
       </label>
+      <input id="email" type="email" value="test@example.com" />
+      <input id="search" type="search" value="This is a search" />
+      <input id="tel" type="tel" value="555-5555" />
+      <input id="url" type="url" value="http://example.com" />
     </div>
   </body>
 </html>
--- a/dom/locales/en-US/chrome/accessibility/AccessFu.properties
+++ b/dom/locales/en-US/chrome/accessibility/AccessFu.properties
@@ -67,16 +67,22 @@ note           =       note
 figure         =       figure
 definitionlist =       definition list
 term           =       term
 definition     =       definition
 
 # More sophisticated roles which are not actual numeric roles
 textarea       =       text area
 
+# Text input types
+textInputType_email  =       e-mail
+textInputType_search =       search
+textInputType_tel    =       telephone
+textInputType_url    =       URL
+
 # More sophisticated object descriptions
 headingLevel   =       heading level %S
 
 # more sophisticated list announcement
 listStart      =       First item
 listEnd        =       Last item
 # LOCALIZATION NOTE (listItemsCount): Semi-colon list of plural forms.
 # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals