[orca] Don't treat an element as a text block element if it has no text



commit 15808d111dd8ea8cc150fdf89e603fc40d08752e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed May 15 16:01:24 2019 +0200

    Don't treat an element as a text block element if it has no text
    
    The logic associated with text block elements is based on the fact that
    there is static text to be had in these elements and thus the object
    shouldn't' be treated as a whole. That fails for things like table cells
    in a non-interactive table which have an author-provided name in lieu of
    text.

 src/orca/scripts/web/script_utilities.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index a5afdc935..b3489112f 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1857,6 +1857,7 @@ class Utilities(script_utilities.Utilities):
         try:
             role = obj.getRole()
             state = obj.getState()
+            interfaces = pyatspi.listInterfaces(obj)
         except:
             msg = "WEB: Exception getting role and state for %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
@@ -1865,6 +1866,10 @@ class Utilities(script_utilities.Utilities):
         textBlockElements = self._textBlockElementRoles()
         if not role in textBlockElements:
             rv = False
+        elif not "Text" in interfaces:
+            rv = False
+        elif not obj.queryText().characterCount:
+            rv = False
         elif state.contains(pyatspi.STATE_EDITABLE):
             rv = False
         elif role in [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]:


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