[orca] Web: Improve location recovery using interactive trees in browse mode



commit f174538c4d33285d80c8f040f2a18b544369617b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Mar 23 14:18:42 2021 +0100

    Web: Improve location recovery using interactive trees in browse mode
    
    If the user expands/collapses an ARIA tree item, there will likely be
    children-changed events which will cause us to dump our cache. When
    the user is in focus mode, subsequent focus/selection events emitted
    by the web app will make it possible for us to update the caret context
    so we know where we are with respect to the page. In browse mode, we
    likely won't get those events. Therefore, update the caret context when
    we get an expanded-changed event for the locusOfFocus and do not have
    a cached caret context. This should keep us from jumping to the wrong
    location (i.e. outside of the tree) in response to the next arrow press.

 src/orca/scripts/web/script.py | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 618edbd28..402662b84 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1938,6 +1938,15 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
+        obj, offset = self.utilities.getCaretContext(searchIfNeeded=False)
+        msg = "WEB: Caret context is %s, %i (focus: %s)" % (obj, offset, orca_state.locusOfFocus)
+        debug.println(debug.LEVEL_INFO, msg, True)
+
+        if not obj or self.utilities.isZombie(obj) and event.source == orca_state.locusOfFocus:
+            msg = "WEB: Setting caret context to event source"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            self.utilities.setCaretContext(event.source, 0)
+
         return False
 
     def onFocus(self, event):


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