[orca] Chromium: Work around lack of focus on ancestor links when setting caret



commit a3ab58650fc3a874ce75b0b5653e872c60402d16
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jun 13 23:49:09 2019 -0400

    Chromium: Work around lack of focus on ancestor links when setting caret

 src/orca/scripts/toolkits/Chromium/script_utilities.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/orca/scripts/toolkits/Chromium/script_utilities.py 
b/src/orca/scripts/toolkits/Chromium/script_utilities.py
index 25b1e9aa9..38c2ff008 100644
--- a/src/orca/scripts/toolkits/Chromium/script_utilities.py
+++ b/src/orca/scripts/toolkits/Chromium/script_utilities.py
@@ -322,3 +322,13 @@ class Utilities(web.Utilities):
                 return True
 
         return False
+
+    def setCaretPosition(self, obj, offset, documentFrame=None):
+        super().setCaretPosition(obj, offset, documentFrame)
+
+        isLink = lambda x: x and x.getRole() == pyatspi.ROLE_LINK
+        link = pyatspi.utils.findAncestor(obj, isLink)
+        if link:
+            msg = "CHROMIUM: HACK: Grabbing focus on %s's ancestor %s" % (obj, link)
+            debug.println(debug.LEVEL_INFO, msg, True)
+            self.grabFocus(link)


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