[orca] Web: Ignore text selection changes in entries preceding focus/caret-moved



commit a31aab28b4c3a6dc2b253b0b44f1b3baa83086f5
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Apr 12 17:55:05 2022 +0200

    Web: Ignore text selection changes in entries preceding focus/caret-moved
    
    If we get a caret-moved event or focus-change event for a focused entry,
    we update the locusOfFocus and then present the widget and text, including
    any text selection. Right now we're automatically presenting text selection
    changes in editable content which is not the locusOfFocus. This leads to
    double-presentation because the caret-moved event and/or focus-change event
    will follow.
    
    This commit eliminates that chattiness by waiting for the subsequent event.

 src/orca/scripts/web/script.py | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 0a50c4b12..6e459972c 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -2501,6 +2501,13 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, 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
+
         if self.utilities.isContentEditableWithEmbeddedObjects(event.source):
             msg = "WEB: In content editable with embedded objects"
             debug.println(debug.LEVEL_INFO, msg, True)


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