[orca] Ensure we don't skip role presentation in contenteditable content



commit f122be871f5682f64bfc76eb29ed98b974f5c3d2
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 28 12:55:52 2020 +0100

    Ensure we don't skip role presentation in contenteditable content

 src/orca/scripts/web/speech_generator.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index 95a2f0c99..47e9d89d6 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -513,22 +513,24 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
             if self._script.utilities.isMenuInCollapsedSelectElement(obj):
                 doNotSpeak.append(pyatspi.ROLE_MENU)
 
-        if obj.getState().contains(pyatspi.STATE_EDITABLE) and role != pyatspi.ROLE_HEADING:
-            lastKey, mods = self._script.utilities.lastKeyAndModifiers()
+        lastKey, mods = self._script.utilities.lastKeyAndModifiers()
+        isEditable = obj.getState().contains(pyatspi.STATE_EDITABLE)
+
+        if isEditable and not self._script.utilities.isContentEditableWithEmbeddedObjects(obj):
             if ((lastKey in ["Down", "Right"] and not mods) or self._script.inSayAll()) and start:
                 return []
             if lastKey in ["Up", "Left"] and not mods:
                 text = self._script.utilities.queryNonEmptyText(obj)
                 if text and end not in [None, text.characterCount]:
                     return []
-            if role in [pyatspi.ROLE_ENTRY, pyatspi.ROLE_PASSWORD_TEXT, pyatspi.ROLE_SPIN_BUTTON]:
-                result.append(self.getLocalizedRoleName(obj, **args))
-            elif obj.parent and not obj.parent.getState().contains(pyatspi.STATE_EDITABLE):
-                if lastKey not in ["Home", "End", "Up", "Down", "Left", "Right", "Page_Up", "Page_Down"]:
-                    result.append(object_properties.ROLE_EDITABLE_CONTENT)
-            elif role not in doNotSpeak:
+            if role not in doNotSpeak:
                 result.append(self.getLocalizedRoleName(obj, **args))
-            if result:
+                result.extend(acss)
+
+        elif isEditable and self._script.utilities.isDocument(obj):
+            if obj.parent and not obj.parent.getState().contains(pyatspi.STATE_EDITABLE) \
+               and lastKey not in ["Home", "End", "Up", "Down", "Left", "Right", "Page_Up", "Page_Down"]:
+                result.append(object_properties.ROLE_EDITABLE_CONTENT)
                 result.extend(acss)
 
         elif role == pyatspi.ROLE_HEADING:


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