[orca] Web: Improve logic identifying text brokenness due to it being off-screen



commit a129be1a929fdb25eb722d0d92e1f68ca73f3abc
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 19 15:23:47 2021 +0100

    Web: Improve logic identifying text brokenness due to it being off-screen
    
    When authors hide text just for screen-reader users to find, it is
    often exposed to us via the accessible text interface as if there were
    only one character per line. We have logic to check for this case, but
    it wasn't catching things like:
    
    * our getting a valid line when the first character is an embedded
      object, but subsequent characters are not
    * our getting a character along with a space (two characters are
      not a single character)
    
    Therefore add handling to ignore results when the character at offset
    is embedded object, and strip whitespace before examining the supposed
    line at offset.

 src/orca/scripts/web/script_utilities.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 0fa5f60ba..3db4e5bb0 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3136,8 +3136,11 @@ class Utilities(script_utilities.Utilities):
         if rv:
             boundary = pyatspi.TEXT_BOUNDARY_LINE_START
             for i in range(nChars):
+                if text.getText(i, i + 1) == self.EMBEDDED_OBJECT_CHARACTER:
+                    continue
+
                 string, start, end = text.getTextAtOffset(i, boundary)
-                if len(string) != 1:
+                if len(string.strip()) > 1:
                     rv = False
                     break
 


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