[orca] Web: Prevent getting stuck when up arrowing with multiple newline chars



commit 4f14e968549ad0ee3b5d2d7a34e8e0249075ea3b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Feb 16 18:53:39 2021 +0100

    Web: Prevent getting stuck when up arrowing with multiple newline chars
    
    The presence of multiple newline characters in content can lead to us
    getting the same line via the accessible text interface. If we don't
    sanity check and handle this condition, the user can get stuck in
    content. We were handling this condition for moving forward by line,
    but not backward by line. Apply the same strategy, namely if we get
    the same line for a previous offset decrement the offset again and
    try once more.

 src/orca/scripts/web/script_utilities.py | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9746f24d9..ea68c2e07 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1846,6 +1846,12 @@ class Utilities(script_utilities.Utilities):
             debug.println(debug.LEVEL_INFO, msg, True)
             return []
 
+        if line == contents:
+            obj, offset = self.previousContext(obj, offset, True)
+            msg = "WEB: Got same line. Trying again with %s, %i" % (obj, offset)
+            debug.println(debug.LEVEL_INFO, msg, True)
+            contents = self.getLineContentsAtOffset(obj, offset, layoutMode, useCache)
+
         return contents
 
     def getNextLineContents(self, obj=None, offset=-1, layoutMode=None, useCache=True):


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