[orca] Don't treat grids as layout-only, or gridcells as text-block elements



commit 1793730e241f7808a360ed6908734d4557253913
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Nov 30 14:48:16 2020 +0100

    Don't treat grids as layout-only, or gridcells as text-block elements
    
    The heuristics we have to identify items as layout-only and text-block
    assume things like grids will have a name (as per the ARIA spec). And
    that the gridcells (rather than a descendant) will be what is given
    focus by the author. We should instead just look at the ARIA role.

 src/orca/script_utilities.py             |  6 ++++++
 src/orca/scripts/web/script_utilities.py | 10 ++++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 5dff59abc..8fa931449 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -937,6 +937,12 @@ class Utilities:
     def isFigure(self, obj):
         return False
 
+    def isGrid(self, obj):
+        return False
+
+    def isGridCell(self, obj):
+        return False
+
     def supportsLandmarkRole(self):
         return False
 
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index dc1f33290..9b5f2f79d 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2175,6 +2175,8 @@ class Utilities(script_utilities.Utilities):
             rv = False
         elif state.contains(pyatspi.STATE_EDITABLE):
             rv = False
+        elif self.isGridCell(obj):
+            rv = False
         elif role in [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]:
             rv = True
         elif not state.contains(pyatspi.STATE_FOCUSABLE) and not state.contains(pyatspi.STATE_FOCUSED):
@@ -2957,6 +2959,8 @@ class Utilities(script_utilities.Utilities):
             rv = False
         elif self.isFigure(obj):
             rv = False
+        elif self.isGrid(obj):
+            rv = False
         elif role in [pyatspi.ROLE_COLUMN_HEADER, pyatspi.ROLE_ROW_HEADER]:
             rv = False
         elif role == pyatspi.ROLE_SEPARATOR:
@@ -3557,6 +3561,12 @@ class Utilities(script_utilities.Utilities):
 
         return pyatspi.findDescendant(obj, _isMatch) is not None
 
+    def isGrid(self, obj):
+        return 'grid' in self._getXMLRoles(obj)
+
+    def isGridCell(self, obj):
+        return 'gridcell' in self._getXMLRoles(obj)
+
     def isInlineListItem(self, obj):
         if not (obj and self.inDocumentContent(obj)):
             return False


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]