[orca] Web: Ignore caret-moved events for the document itself when Tab is used



commit d8fed6f41c06f1a51c038c0ad94c64684784e9d8
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Dec 9 17:43:06 2020 +0100

    Web: Ignore caret-moved events for the document itself when Tab is used
    
    When the user Tabs into the document, we sometimes see a caret-moved
    event for the document. This causes us to look for the first presentable
    thing at offset and update our location to that thing. If the first
    presentable thing in the document happens to be a focusable widget,
    this can cause us to present the focusable widget as if it were focused
    and to ignore a subsequent focus event for when it really becomes focused.
    On the other hand, if the first presentable thing is a text element such
    as a paragraph, we should be getting the caret moved event for that
    element rather than from the document.

 src/orca/script_utilities.py   | 7 +++++++
 src/orca/scripts/web/script.py | 5 +++++
 2 files changed, 12 insertions(+)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 54bf78f4d..ec72e4395 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -5309,6 +5309,13 @@ class Utilities:
 
         return mods & keybindings.CTRL_MODIFIER_MASK
 
+    def lastInputEventWasTab(self):
+        keyString, mods = self.lastKeyAndModifiers()
+        if keyString not in ["Tab", "ISO_Left_Tab"]:
+            return False
+
+        return not mods or mods & keybindings.SHIFT_MODIFIER_MASK
+
     def lastInputEventWasPrimaryMouseClick(self):
         event = orca_state.lastInputEvent
         if isinstance(event, input_event.MouseButtonEvent):
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 7f019b5e5..b82b66741 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1578,6 +1578,11 @@ class Script(default.Script):
                 self.updateBraille(event.source)
             return True
 
+        if self.utilities.lastInputEventWasTab() and self.utilities.isDocument(event.source):
+            msg = "WEB: Event ignored: Caret moved in document due to Tab."
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         if self.utilities.inFindContainer():
             msg = "WEB: Event handled: Presenting find results"
             debug.println(debug.LEVEL_INFO, msg, True)


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