[orca] Web: Don't speak contents if new focus has died and focus event queued



commit 6f6bdacd1dec1524101d971a1ba55c6dc1e0303c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Apr 20 15:23:58 2022 +0200

    Web: Don't speak contents if new focus has died and focus event queued
    
    If the newly-focused object gets destroyed during line contents
    generation, and if we have a new focus event, return early. This
    should hopefully reduce some chattiness as well as some broken
    presentation (e.g. if the destroyed object is in the middle of valid
    objects)

 src/orca/scripts/web/script.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 042baf596..3714c21c9 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1291,6 +1291,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        if newFocus and self.utilities.isDead(newFocus):
+            msg = "WEB: New focus is dead: %s" % newFocus
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         document = self.utilities.getTopLevelDocumentForObject(newFocus)
         if not document and self.utilities.isDocument(newFocus):
             document = newFocus
@@ -1374,6 +1379,14 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             args['priorObj'] = oldFocus
 
+        if newFocus and self.utilities.isDead(newFocus):
+            msg = "WEB: New focus has since died: %s" % newFocus
+            debug.println(debug.LEVEL_INFO, msg, True)
+            if self._getQueuedEvent("object:state-changed:focused", True):
+                msg = "WEB: Have matching focused event. Not speaking contents"
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return True
+
         if contents:
             self.speakContents(contents, **args)
         else:


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