[orca] Grab focus on headings with a single, link child



commit 758479864d729a518b2b187a5f24f803f36859bc
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Feb 12 10:15:55 2019 -0500

    Grab focus on headings with a single, link child
    
    This is to work around Firefox not reliably updating the caret position when
    navigating by heading.

 src/orca/scripts/web/script_utilities.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 6fe0aaa05..42c74f6fe 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -343,8 +343,9 @@ class Utilities(script_utilities.Utilities):
         try:
             role = obj.getRole()
             state = obj.getState()
+            childCount = obj.childCount
         except:
-            msg = "WEB: Exception getting role and state for %s" % obj
+            msg = "WEB: Exception getting role, state, and childCount for %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
@@ -356,6 +357,9 @@ class Utilities(script_utilities.Utilities):
             isLink = lambda x: x and x.getRole() == pyatspi.ROLE_LINK
             return pyatspi.utils.findAncestor(obj, isLink) is not None
 
+        if role == pyatspi.ROLE_HEADING and childCount == 1:
+            return self.isLink(obj[0])
+
         return state.contains(pyatspi.STATE_FOCUSABLE)
 
     def grabFocus(self, obj):


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