[orca] Try to prevent some chattiness when composing messages in gmail



commit df7202dd4f16d2d0e88474edd0e95b5958aed94e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Mar 2 22:46:31 2020 +0100

    Try to prevent some chattiness when composing messages in gmail
    
    * Treat multi-line elements with role entry as content editable with
      embedded objects if they have at least one text block element as a
      descendant
    * Don't speak labelOrName when using caret-navigation keys within
      content-editable content with embedded objects

 src/orca/scripts/web/script_utilities.py | 8 +++++---
 src/orca/scripts/web/speech_generator.py | 5 +++++
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 2cfcb695e..809783140 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4124,9 +4124,11 @@ class Utilities(script_utilities.Utilities):
             debug.println(debug.LEVEL_INFO, msg, True)
             return rv
 
-        isTextBlockRole = role in self._textBlockElementRoles() or self.isLink(obj)
-        if state.contains(pyatspi.STATE_EDITABLE):
-            rv = isTextBlockRole
+        hasTextBlockRole = lambda x: x and x.getRole() in self._textBlockElementRoles()
+        if role == pyatspi.ROLE_ENTRY and state.contains(pyatspi.STATE_MULTI_LINE):
+            rv = pyatspi.findDescendant(obj, hasTextBlockRole)
+        elif state.contains(pyatspi.STATE_EDITABLE):
+            rv = hasTextBlockRole(obj) or self.isLink(obj)
         elif not self.isDocument(obj):
             document = self.getDocumentForObject(obj)
             rv = self.isContentEditableWithEmbeddedObjects(document)
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index 47e9d89d6..4c1b55031 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -315,6 +315,11 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
            and not self._script.utilities.isContentSuggestion(obj):
             return []
 
+        if self._script.utilities.isContentEditableWithEmbeddedObjects(obj):
+            lastKey, mods = self._script.utilities.lastKeyAndModifiers()
+            if lastKey in ["Home", "End", "Up", "Down", "Left", "Right", "Page_Up", "Page_Down"]:
+                return []
+
         if obj.name:
             name = obj.name
             if not self._script.utilities.hasExplicitName(obj):


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