[orca] Present aria-invalid info for non-widget elements



commit 981883dbe38f608312cbd1de3a69abfab40174c2
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Feb 26 12:39:20 2020 +0100

    Present aria-invalid info for non-widget elements

 src/orca/formatting.py                   | 3 +++
 src/orca/generator.py                    | 2 ++
 src/orca/script_utilities.py             | 3 +++
 src/orca/scripts/web/script_utilities.py | 9 +++++++++
 4 files changed, 17 insertions(+)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index ed8faf063..be3f54917 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -183,6 +183,9 @@ formatting = {
             'focused': 'leaving or deletionStart',
             'unfocused': 'deletionStart + pause + displayedText + pause + deletionEnd',
             },
+        'ROLE_CONTENT_ERROR': {
+            'unfocused': 'displayedText + pause + invalid',
+            },
         # TODO - JD: When we bump dependencies to 2.34, remove this fake role and use the real one.
         'ROLE_CONTENT_INSERTION': {
             'focused': 'leaving or insertionStart',
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 3d64e0c0f..254d82743 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -1233,6 +1233,8 @@ class Generator:
             return pyatspi.ROLE_COMMENT
         if self._script.utilities.isContentDeletion(obj):
             return 'ROLE_CONTENT_DELETION'
+        if self._script.utilities.isContentError(obj):
+            return 'ROLE_CONTENT_ERROR'
         if self._script.utilities.isContentInsertion(obj):
             return 'ROLE_CONTENT_INSERTION'
         if self._script.utilities.isContentMarked(obj):
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 26582cc5b..ef24c3772 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -774,6 +774,9 @@ class Utilities:
     def isContentDeletion(self, obj):
         return False
 
+    def isContentError(self, obj):
+        return False
+
     def isContentInsertion(self, obj):
         return False
 
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 854f8ef2e..bf1532326 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2117,6 +2117,15 @@ class Utilities(script_utilities.Utilities):
 
         return 'deletion' in self._getXMLRoles(obj) or 'del' == self._getTag(obj)
 
+    def isContentError(self, obj):
+        if not (obj and self.inDocumentContent(obj)):
+            return super().isContentError(obj)
+
+        if obj.getRole() not in self._textBlockElementRoles():
+            return False
+
+        return obj.getState().contains(pyatspi.STATE_INVALID_ENTRY)
+
     def isContentInsertion(self, obj):
         if not (obj and self.inDocumentContent(obj)):
             return super().isContentInsertion(obj)


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