Commit 2f98effe authored by Joanmarie Diggs's avatar Joanmarie Diggs

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.
parent e5b7902f
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment