[orca] Web: Present the current line when mouse click moves caret; set priorObj



commit 2f98effe585a6c49f547d6c44d5d211d11953e76
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Dec 22 16:21:45 2020 +0100

    Web: Present the current line when mouse click moves caret; set priorObj
    
    There were special occasions (such as headings) when caret moved events
    caused the entire object to be presented when clicking with the physical
    mouse. This was not intentional. Move mouse-button handling to the top
    of the logic where we determine what to present when the locusOfFocus
    changes.
    
    In addition, explicitly set the prior object to the old focus for mouse-
    button-triggered caret-moved events. This should ensure we present roles
    when initially clicking into a new element.

 src/orca/scripts/web/script.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 3bb4bd801..35aa95148 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1280,7 +1280,13 @@ class Script(default.Script):
         self.updateBraille(newFocus)
         orca.emitRegionChanged(newFocus, caretOffset)
 
-        if self.utilities.isContentEditableWithEmbeddedObjects(newFocus) \
+        if self._lastCommandWasMouseButton and event \
+             and event.type.startswith("object:text-caret-moved"):
+            msg = "WEB: Last input event was mouse button. Generating line contents."
+            debug.println(debug.LEVEL_INFO, msg, True)
+            contents = self.utilities.getLineContentsAtOffset(newFocus, caretOffset)
+            utterances = self.speechGenerator.generateContents(contents, priorObj=oldFocus)
+        elif self.utilities.isContentEditableWithEmbeddedObjects(newFocus) \
            and not (newFocus.getRole() == pyatspi.ROLE_TABLE_CELL and newFocus.name):
             msg = "WEB: New focus %s content editable. Generating line contents." % newFocus
             debug.println(debug.LEVEL_INFO, msg, True)
@@ -1322,12 +1328,6 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             contents = self.utilities.getLineContentsAtOffset(newFocus, caretOffset)
             utterances = self.speechGenerator.generateContents(contents)
-        elif self._lastCommandWasMouseButton and event \
-             and event.type.startswith("object:text-caret-moved"):
-            msg = "WEB: Last input event was mouse button. Generating line contents."
-            debug.println(debug.LEVEL_INFO, msg, True)
-            contents = self.utilities.getLineContentsAtOffset(newFocus, caretOffset)
-            utterances = self.speechGenerator.generateContents(contents)
         else:
             msg = "WEB: New focus %s is not a special case. Generating speech." % newFocus
             debug.println(debug.LEVEL_INFO, msg, True)


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