Bug 812515 - Land on static text if it is not a list bullet item. r=davidb
authorEitan Isaacson <eitan@monotonous.org>
Tue, 20 Nov 2012 11:06:38 -0800
changeset 113804 51d2b0ccc4b5de0de6d3dba263539064040228a0
parent 113803 fb729e54421e96f8424704a4930c5bafceefafdd
child 113805 1b8b5ca28225f5a3e78d8e48e8e931753b622249
push id23890
push userryanvm@gmail.com
push dateWed, 21 Nov 2012 02:43:32 +0000
treeherdermozilla-central@4f19e7fd8bea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs812515
milestone20.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 812515 - Land on static text if it is not a list bullet item. r=davidb
accessible/src/jsat/TraversalRules.jsm
--- a/accessible/src/jsat/TraversalRules.jsm
+++ b/accessible/src/jsat/TraversalRules.jsm
@@ -45,20 +45,17 @@ BaseTraversalRule.prototype = {
     QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
 };
 
 var gSimpleTraversalRoles =
   [Ci.nsIAccessibleRole.ROLE_MENUITEM,
    Ci.nsIAccessibleRole.ROLE_LINK,
    Ci.nsIAccessibleRole.ROLE_PAGETAB,
    Ci.nsIAccessibleRole.ROLE_GRAPHIC,
-   // XXX: Find a better solution for ROLE_STATICTEXT.
-   // It allows to filter list bullets but at the same time it
-   // filters CSS generated content too as an unwanted side effect.
-   // Ci.nsIAccessibleRole.ROLE_STATICTEXT,
+   Ci.nsIAccessibleRole.ROLE_STATICTEXT,
    Ci.nsIAccessibleRole.ROLE_TEXT_LEAF,
    Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
    Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
    Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
    Ci.nsIAccessibleRole.ROLE_COMBOBOX,
    Ci.nsIAccessibleRole.ROLE_PROGRESSBAR,
    Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
    Ci.nsIAccessibleRole.ROLE_BUTTONMENU,
@@ -90,16 +87,26 @@ this.TraversalRules = {
         }
       case Ci.nsIAccessibleRole.ROLE_LINK:
         // If the link has children we should land on them instead.
         // Image map links don't have children so we need to match those.
         if (aAccessible.childCount == 0)
           return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
         else
           return Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
+      case Ci.nsIAccessibleRole.ROLE_STATICTEXT:
+        {
+          let parent = aAccessible.parent;
+          // Ignore prefix static text in list items. They are typically bullets or numbers.
+          if (parent.childCount > 1 && aAccessible.indexInParent == 0 &&
+              parent.role == Ci.nsIAccessibleRole.ROLE_LISTITEM)
+            return Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
+
+          return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
+        }
       default:
         // Ignore the subtree, if there is one. So that we don't land on
         // the same content that was already presented by its parent.
         return Ci.nsIAccessibleTraversalRule.FILTER_MATCH |
           Ci.nsIAccessibleTraversalRule.FILTER_IGNORE_SUBTREE;
       }
     }
   ),