[orca] Web: Handle text insertion events preceding focus events for entries



commit c908df247df3e0779d05455c807a28639349d645
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Apr 20 13:28:59 2022 +0200

    Web: Handle text insertion events preceding focus events for entries
    
    When navigating amongst entries, we ignore the text-selection-changed
    events if we haven't yet received the focused event for that entry.
    We need to do something similar in the case of entries whose text is
    populated immediately before focus for two reasons: 1) The default
    script silently updates the locus of focus which means the role is
    not announced, but the text is still spoken. 2) If we then get a
    text-selection-changed event, we present it again because it now is
    coming from the locus of focus. Waiting until we get the focus event
    ensures we announce the role, the text contents, and any selection
    present.

 src/orca/orca.py               | 2 +-
 src/orca/scripts/web/script.py | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 2eee3eec9..b61fc1d45 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -204,7 +204,7 @@ def setLocusOfFocus(event, obj, notifyScript=True, force=False):
             debug.println(debug.LEVEL_INFO, msg, True)
             return
 
-    msg = "ORCA: Changing locusOfFocus from %s to %s" % (oldFocus, obj)
+    msg = "ORCA: Changing locusOfFocus from %s to %s. Notify: %s" % (oldFocus, obj, notifyScript)
     debug.println(debug.LEVEL_INFO, msg, True)
     orca_state.locusOfFocus = obj
 
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index d1c40efc3..042baf596 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -2462,6 +2462,13 @@ class Script(default.Script):
                 orca.setLocusOfFocus(None, event.source, force=True)
                 return True
 
+        if event.source.getRole() in [pyatspi.ROLE_ENTRY, pyatspi.ROLE_SPIN_BUTTON] \
+           and event.source.getState().contains(pyatspi.STATE_FOCUSED) \
+           and event.source != orca_state.locusOfFocus:
+            msg = "WEB: Focused entry is not the locus of focus. Waiting for focus event."
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         return False
 
     def onTextSelectionChanged(self, event):


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