[orca] Web: Announce locusOfFocus update during object destruction



commit dbd2237af9ed413431f9361b924f5a999f4f3f7c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jan 31 14:45:24 2022 +0100

    Web: Announce locusOfFocus update during object destruction
    
    Some web apps destroy the focused object and replace it. We normally
    handle this silently in order to not be chatty. Sometimes, however,
    not saying anything can result in not presenting an object which is
    about to claim focus. Our choice is to not try to recover and hope
    we get a focus event from the browser (which might not occur), or
    risk being chatty and presenting the object if it's focused. This
    commit does the latter.

 src/orca/scripts/web/script_utilities.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index f60114520..9809d9664 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -5019,6 +5019,11 @@ class Utilities(script_utilities.Utilities):
         else:
             notify = False
             obj, offset = self.searchForCaretContext(event.source)
+            # Risk "chattiness" if the locusOfFocus is dead and the object we've found is
+            # focused.
+            if obj and self.isDead(orca_state.locusOfFocus) \
+               and obj.getState().contains(pyatspi.STATE_FOCUSED):
+                notify = True
 
         if obj:
             msg = "WEB: Setting locusOfFocus and context to: %s, %i" % (obj, offset)


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