[orca] Web: Return next caret context as first caret context for empty anchor



commit b27cffd353373b96ccc18eec008466d162669865
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Jan 6 11:16:37 2021 +0100

    Web: Return next caret context as first caret context for empty anchor
    
    Unfortunately, empty anchors can appear in the accessibility tree.
    If caret navigation causes us to land on one, there's nothing to
    present. Therefore look for and move to the first presentable thing
    after the empty anchor.

 src/orca/scripts/web/script_utilities.py | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 92497a645..1ee44a722 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4830,6 +4830,14 @@ class Utilities(script_utilities.Utilities):
             debug.println(debug.LEVEL_INFO, msg, True)
             return obj, offset + 1
 
+        if self.isEmptyAnchor(child):
+            nextObj, nextOffset = self.nextContext(obj, offset)
+            if nextObj:
+                msg = "WEB: First caret context at end of empty anchor %s is next context %s, %i" % \
+                    (obj, nextObj, nextOffset)
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return nextObj, nextOffset
+
         if not self._canHaveCaretContext(child):
             msg = "WEB: Child cannot be context. Returning %s, %i unchanged." % (obj, offset)
             debug.println(debug.LEVEL_INFO, msg, True)


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