[orca] Web: Improve recovery from destruction of current object



commit 7c9e8a4891b2de0cd8cb6bc0d675c3942a0ae29d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jun 25 16:03:24 2021 +0200

    Web: Improve recovery from destruction of current object
    
    When we received an event signaling the removal of the locusOfFocus,
    we attempted recovery. We were not attempting this recovery if the
    removed child was an ancestor of the locusOfFocus. This commit does
    so and should make it more likely that we do not lose our place if
    a web app destroys the active element.

 src/orca/scripts/web/script_utilities.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 426366581..a60d98896 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4852,12 +4852,15 @@ class Utilities(script_utilities.Utilities):
         return True
 
     def handleEventForRemovedChild(self, event):
-        if event.any_data != orca_state.locusOfFocus:
+        if event.any_data == orca_state.locusOfFocus:
+            msg = "WEB: Removed child is locusOfFocus."
+            debug.println(debug.LEVEL_INFO, msg, True)
+        elif pyatspi.findAncestor(orca_state.locusOfFocus, lambda x: x == event.any_data):
+            msg = "WEB: Removed child is ancestor of locusOfFocus."
+            debug.println(debug.LEVEL_INFO, msg, True)
+        else:
             return False
 
-        msg = "WEB: Removed child is locusOfFocus."
-        debug.println(debug.LEVEL_INFO, msg, True)
-
         if event.detail1 == -1:
             msg = "WEB: Event detail1 is useless."
             debug.println(debug.LEVEL_INFO, msg, True)


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