Bug 1203283 - Introduce Android "Control" traversal rule. r=yzen
authorEitan Isaacson <eitan@monotonous.org>
Mon, 14 Sep 2015 10:52:43 -0700
changeset 294999 a2e610b46e85597e865a601c5d3f6c381702fbba
parent 294998 be192df7732ea1d5c2d31c20b618145fc029cc67
child 295000 2ed46aca6ae071b59fb287f3aaf325129d9e4327
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1203283
milestone43.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 1203283 - Introduce Android "Control" traversal rule. r=yzen
accessible/jsat/Traversal.jsm
accessible/tests/mochitest/jsat/test_traversal.html
--- a/accessible/jsat/Traversal.jsm
+++ b/accessible/jsat/Traversal.jsm
@@ -291,16 +291,46 @@ this.TraversalRules = { // jshint ignore
       // We want to ignore anchors, only focus real links.
       if (Utils.getState(aAccessible).contains(States.LINKED)) {
         return Filters.MATCH;
       } else {
         return Filters.IGNORE;
       }
     }),
 
+  /* For TalkBack's "Control" granularity. Form conrols and links */
+  Control: new BaseTraversalRule(
+    [Roles.PUSHBUTTON,
+     Roles.SPINBUTTON,
+     Roles.TOGGLE_BUTTON,
+     Roles.BUTTONDROPDOWN,
+     Roles.BUTTONDROPDOWNGRID,
+     Roles.COMBOBOX,
+     Roles.LISTBOX,
+     Roles.ENTRY,
+     Roles.PASSWORD_TEXT,
+     Roles.PAGETAB,
+     Roles.RADIOBUTTON,
+     Roles.RADIO_MENU_ITEM,
+     Roles.SLIDER,
+     Roles.CHECKBUTTON,
+     Roles.CHECK_MENU_ITEM,
+     Roles.SWITCH,
+     Roles.LINK,
+     Roles.MENUITEM],
+    function Control_match(aAccessible)
+    {
+      // We want to ignore anchors, only focus real links.
+      if (aAccessible.role == Roles.LINK &&
+          !Utils.getState(aAccessible).contains(States.LINKED)) {
+        return Filters.IGNORE;
+      }
+      return Filters.MATCH;
+    }),
+
   List: new BaseTraversalRule(
     [Roles.LIST,
      Roles.DEFINITION_LIST],
     null, null, true),
 
   PageTab: new BaseTraversalRule(
     [Roles.PAGETAB]),
 
--- a/accessible/tests/mochitest/jsat/test_traversal.html
+++ b/accessible/tests/mochitest/jsat/test_traversal.html
@@ -125,16 +125,27 @@
                               'Dirty Words', 'Meaning', 'Mud', 'Wet Dirt',
                               'Dirt', 'Messy Stuff', 'statusbar-1', 'statusbar-2',
                               'switch-1', 'This is a MathML formula ', 'math-1',
                               'with some text after.']);
 
       queueTraversalSequence(gQueue, docAcc, TraversalRules.Landmark, null,
                              ['header-1', 'main-1', 'footer-1']);
 
+
+      queueTraversalSequence(gQueue, docAcc, TraversalRules.Control, null,
+                             ['input-1-1', 'label-1-2', 'button-1-1',
+                              'radio-1-1', 'radio-1-2', 'input-1-3',
+                              'input-1-4', 'button-1-2', 'checkbox-1-1',
+                              'select-1-1', 'select-1-2', 'checkbox-1-2',
+                              'select-1-3', 'input-1-5', 'button-1-3',
+                              'button-2-1', 'button-2-2', 'button-2-3',
+                              'button-2-4', 'link-0', 'checkbox-1-5',
+                              'link-1', 'link-2', 'link-3', 'switch-1']);
+
       gQueue.invoke();
     }
 
     SimpleTest.waitForExplicitFinish();
     addLoadEvent(function () {
       /* We open a new browser because we need to test with a top-level content
          document. */
       openBrowserWindow(