Bug 1136241 - making sure that hint/role strings are returned with no spaces to support localization. r=eeejay
authorYura Zenevich <yzenevich@mozilla.com>
Wed, 25 Feb 2015 16:33:34 -0500
changeset 259668 18365d823fdf8c524c2be59507f43e3aa47ee0a8
parent 259624 31d67d0ed3cb03dc9209ef8d8e0f9541b818018d
child 259669 49f1f94b73af6943a55233e57cbff35b41185c7a
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1136241
milestone39.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 1136241 - making sure that hint/role strings are returned with no spaces to support localization. r=eeejay --- accessible/jsat/OutputGenerator.jsm | 2 +- accessible/jsat/Utils.jsm | 3 ++- accessible/tests/mochitest/jsat/test_hints.html | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-)
accessible/jsat/OutputGenerator.jsm
accessible/jsat/Utils.jsm
accessible/tests/mochitest/jsat/test_hints.html
--- a/accessible/jsat/OutputGenerator.jsm
+++ b/accessible/jsat/OutputGenerator.jsm
@@ -218,17 +218,17 @@ let OutputGenerator = {
     if (!this._utteranceOrder) {
       this._utteranceOrder = new PrefCache('accessibility.accessfu.utterance');
     }
     return typeof this._utteranceOrder.value === 'number' ?
       this._utteranceOrder.value : this.defaultOutputOrder;
   },
 
   _getOutputName: function _getOutputName(aName) {
-    return aName.replace(' ', '');
+    return aName.replace(/\s/g, '');
   },
 
   roleRuleMap: {
     'menubar': INCLUDE_DESC,
     'scrollbar': INCLUDE_DESC,
     'grip': INCLUDE_DESC,
     'alert': INCLUDE_DESC | INCLUDE_NAME,
     'menupopup': INCLUDE_DESC,
--- a/accessible/jsat/Utils.jsm
+++ b/accessible/jsat/Utils.jsm
@@ -843,17 +843,18 @@ PivotContext.prototype = {
   get interactionHints() {
     let hints = [];
     this.newAncestry.concat(this.accessible).reverse().forEach(aAccessible => {
       let hint = Utils.getAttributes(aAccessible)['moz-hint'];
       if (hint) {
         hints.push(hint);
       } else if (aAccessible.actionCount > 0) {
         hints.push({
-          string: Utils.AccRetrieval.getStringRole(aAccessible.role) + '-hint'
+          string: Utils.AccRetrieval.getStringRole(
+            aAccessible.role).replace(/\s/g, '') + '-hint'
         });
       }
     });
     return hints;
   },
 
   /*
    * A subtree generator function, used to generate a flattened
--- a/accessible/tests/mochitest/jsat/test_hints.html
+++ b/accessible/tests/mochitest/jsat/test_hints.html
@@ -38,16 +38,19 @@
         expectedHints: ['Tap and hold to activate']
       }, {
         accOrElmOrID: 'nested_link2',
         expectedHints: [{string: 'link-hint'}]
       }, {
         accOrElmOrID: 'nested_link3',
         expectedHints: [{string: 'link-hint'}, {string: 'pushbutton-hint'},
           "Double tap and hold to activate"]
+      }, {
+        accOrElmOrID: 'menuitemradio',
+        expectedHints: [{string: 'radiomenuitem-hint'}]
       }];
 
       // Test hints.
       tests.forEach(function run(test) {
         testHints(test.expectedHints, test.accOrElmOrID, test.oldAccOrElmOrID);
       });
 
       SimpleTest.finish();
@@ -75,11 +78,12 @@
       </span>
       <span role="region" aria-moz-hint="Double tap and hold to activate">
         <button><a href="#" id="nested_link3">I can be clicked</a></button>
       </span>
       <a href="#" id="link_with_default_hint">I can be clicked</a>
       <a href="#" id="link_with_hint_override" aria-moz-hint="Tap and hold to get to menu">I am a special link</a>
       <button id="button_with_default_hint">Toggle</button>
       <button id="button_with_hint_override" aria-moz-hint="Tap and hold to activate">Special</button>
+      <span id="menuitemradio" role="menuitemradio">Item 1</span>
   </div>
 </body>
 </html>