[orca] Web: Fix issues related to ARIA tooltips



commit a6654e45b4dc04605010428d3bc6a9e57c4928f2
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Sep 3 14:48:44 2021 +0200

    Web: Fix issues related to ARIA tooltips
    
    If an ARIA tooltip claims to be focusable, we treat it as something
    presentable even if it has no size and no content. This leads to
    chattiness, and occasionally even setting the caret in, a useless
    object. The latter can trigger focus events, along with object
    creation and destruction that leads to looping within the content.
    Solve both problems by not allowing an empty tooltip to have the
    caret context.
    
    Also fix a traceback checking for the name of a recently-destroyed
    ARIA tooltip.

 src/orca/scripts/web/script_utilities.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index eda52d149..2c24cf857 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3429,6 +3429,10 @@ class Utilities(script_utilities.Utilities):
 
         return self.queryNonEmptyText(obj) is None
 
+    def isEmptyToolTip(self, obj):
+        return obj and obj.getRole() == pyatspi.ROLE_TOOL_TIP \
+            and self.queryNonEmptyText(obj) is None
+
     def isBrowserUIAlert(self, obj):
         if not (obj and obj.getRole() == pyatspi.ROLE_ALERT):
             return False
@@ -3955,7 +3959,7 @@ class Utilities(script_utilities.Utilities):
         return rv
 
     def hasValidName(self, obj):
-        if not obj.name:
+        if not (obj and obj.name):
             return False
 
         if len(obj.name.split()) > 1:
@@ -4670,6 +4674,10 @@ class Utilities(script_utilities.Utilities):
             msg = "WEB: Empty anchor cannot have caret context %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
+        if self.isEmptyToolTip(obj):
+            msg = "WEB: Empty tool tip cannot have caret context %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
         if self.hasNoSize(obj):
             msg = "WEB: Allowing sizeless object to have caret context %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)


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