[orca] Web: Eliminate double-presentation of caption children in SayAll



commit f8fe00367028cdf1ddc6755fbfe69978a64503e7
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jan 28 15:50:53 2021 +0100

    Web: Eliminate double-presentation of caption children in SayAll
    
    In order to not double-present labels for objects in SayAll, we check
    to see if an object labels the contents or is a label descendant (e.g.
    a link inside of a label). For the purpose of SayAll, captions should
    be treated the same way.

 src/orca/scripts/web/script_utilities.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 435ea74e6..199b34e74 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2874,7 +2874,7 @@ class Utilities(script_utilities.Utilities):
         if rv is not None:
             return rv
 
-        isLabel = lambda x: x and x.getRole() == pyatspi.ROLE_LABEL
+        isLabel = lambda x: x and x.getRole() in [pyatspi.ROLE_LABEL, pyatspi.ROLE_CAPTION]
         rv = pyatspi.findAncestor(obj, isLabel) is not None
         self._isLabelDescendant[hash(obj)] = rv
         return rv
@@ -3280,7 +3280,7 @@ class Utilities(script_utilities.Utilities):
 
         targets = self.labelTargets(obj)
         if not contents:
-            return bool(targets)
+            return bool(targets) or self.isLabelDescendant(obj)
 
         for acc, start, end, string in contents:
             if hash(acc) in targets:
@@ -3297,7 +3297,7 @@ class Utilities(script_utilities.Utilities):
                 continue
 
             ancestor = self.commonAncestor(acc, obj)
-            if ancestor and ancestor.getRole() == pyatspi.ROLE_LABEL:
+            if ancestor and ancestor.getRole() in [pyatspi.ROLE_LABEL, pyatspi.ROLE_CAPTION]:
                 return True
 
         return False


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