[orca] Don't exit focus mode when navigating among text in a web application



commit 1cecdbb6050fce27e5c2f70e4b8f5446408adf4b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Apr 11 15:28:51 2019 -0400

    Don't exit focus mode when navigating among text in a web application

 src/orca/scripts/web/script.py           |  5 +++++
 src/orca/scripts/web/script_utilities.py | 15 +++++++++++++++
 2 files changed, 20 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index fb4fcfaf7..b50e35c84 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -788,6 +788,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        if self._inFocusMode and self.utilities.isWebAppDescendant(obj):
+            msg = "WEB: Staying in focus mode because we're inside a web application"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         msg = "WEB: Not using focus mode for %s due to lack of cause" % obj
         debug.println(debug.LEVEL_INFO, msg, True)
         return False
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 7d5b6d837..0912099b3 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -62,6 +62,7 @@ class Utilities(script_utilities.Utilities):
         self._isLabelDescendant = {}
         self._isMenuDescendant = {}
         self._isToolBarDescendant = {}
+        self._isWebAppDescendant = {}
         self._isLayoutOnly = {}
         self._isDPub = {}
         self._isMath = {}
@@ -133,6 +134,7 @@ class Utilities(script_utilities.Utilities):
         self._isLabelDescendant = {}
         self._isMenuDescendant = {}
         self._isToolBarDescendant = {}
+        self._isWebAppDescendant = {}
         self._isLayoutOnly = {}
         self._isDPub = {}
         self._isMath = {}
@@ -2335,6 +2337,19 @@ class Utilities(script_utilities.Utilities):
         self._isToolBarDescendant[hash(obj)] = rv
         return rv
 
+    def isWebAppDescendant(self, obj):
+        if not obj:
+            return False
+
+        rv = self._isWebAppDescendant.get(hash(obj))
+        if rv is not None:
+            return rv
+
+        isEmbedded = lambda x: x and x.getRole() == pyatspi.ROLE_EMBEDDED
+        rv = pyatspi.findAncestor(obj, isEmbedded) is not None
+        self._isWebAppDescendant[hash(obj)] = rv
+        return rv
+
     def isLayoutOnly(self, obj):
         if not (obj and self.inDocumentContent(obj)):
             return super().isLayoutOnly(obj)


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