[orca] Web: Treat fewer roles as "whole"/non-descendable in browse mode



commit 0cc0ffa35617fa816a5dcd9bf22b81909179b407
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 19 15:47:00 2021 +0100

    Web: Treat fewer roles as "whole"/non-descendable in browse mode
    
    Authors are using ARIA to mark things up as GUI components (menus,
    toolbars, etc.). But then they are not providing any associated
    navigation. As a result, the user has to know to switch to native
    browser navigation (e.g. Tab) to access the descendant items.
    Users who don't realize this can wind up skipping over items.
    Therefore make the following roles always descendable in browse
    mode:
    
    * Menu
    * Menu Bar
    * Tool Bar
    * Tree
    * Tree Table

 src/orca/scripts/web/script_utilities.py | 34 ++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 3db4e5bb0..30af22e0d 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1095,25 +1095,29 @@ class Utilities(script_utilities.Utilities):
         return rv
 
     def _treatObjectAsWhole(self, obj):
-        roles = [pyatspi.ROLE_CHECK_BOX,
-                 pyatspi.ROLE_CHECK_MENU_ITEM,
-                 pyatspi.ROLE_LIST_BOX,
-                 pyatspi.ROLE_MENU,
-                 pyatspi.ROLE_MENU_BAR,
-                 pyatspi.ROLE_MENU_ITEM,
-                 pyatspi.ROLE_RADIO_MENU_ITEM,
-                 pyatspi.ROLE_RADIO_BUTTON,
-                 pyatspi.ROLE_PUSH_BUTTON,
-                 pyatspi.ROLE_TOGGLE_BUTTON,
-                 pyatspi.ROLE_TOOL_BAR,
-                 pyatspi.ROLE_TREE,
-                 pyatspi.ROLE_TREE_ITEM,
-                 pyatspi.ROLE_TREE_TABLE]
+        always = [pyatspi.ROLE_CHECK_BOX,
+                  pyatspi.ROLE_CHECK_MENU_ITEM,
+                  pyatspi.ROLE_LIST_BOX,
+                  pyatspi.ROLE_MENU_ITEM,
+                  pyatspi.ROLE_RADIO_MENU_ITEM,
+                  pyatspi.ROLE_RADIO_BUTTON,
+                  pyatspi.ROLE_PUSH_BUTTON,
+                  pyatspi.ROLE_TOGGLE_BUTTON,
+                  pyatspi.ROLE_TREE_ITEM]
+
+        descendable = [pyatspi.ROLE_MENU,
+                       pyatspi.ROLE_MENU_BAR,
+                       pyatspi.ROLE_TOOL_BAR,
+                       pyatspi.ROLE_TREE,
+                       pyatspi.ROLE_TREE_TABLE]
 
         role = obj.getRole()
-        if role in roles:
+        if role in always:
             return True
 
+        if role in descendable:
+            return self._script.inFocusMode()
+
         if role == pyatspi.ROLE_ENTRY:
             if obj.childCount == 1 and self.isFakePlaceholderForEntry(obj[0]):
                 return True


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