[orca] Chromium: Fix chattiness arrowing up/down in omnibox popup



commit e46f07e8bc215322ae4cb0b06a6da7f5d378c403
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Feb 10 17:31:39 2021 +0100

    Chromium: Fix chattiness arrowing up/down in omnibox popup
    
    We were resetting the locusOfFocus in response to caret-moved events
    received with each selection change. These events should be ignored
    when arrowing up/down in the popup for a single-line autocomplete.
    
    This change is being made in the web script rather than the Chromium-
    specific support because this condition could happen in Firefox too.

 src/orca/scripts/web/script.py           |  5 +++++
 src/orca/scripts/web/script_utilities.py | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index f1eaf247b..19da8f027 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1551,6 +1551,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        if self.utilities.eventIsBrowserUIAutocompleteNoise(event):
+            msg = "WEB: Ignoring event believed to be browser UI autocomplete noise"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         if not self.utilities.inDocumentContent(event.source):
             msg = "WEB: Event source is not in document content"
             debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index acdcc15ef..9746f24d9 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4238,6 +4238,12 @@ class Utilities(script_utilities.Utilities):
         if self.inDocumentContent(event.source):
             return False
 
+        if self._eventIsBrowserUIAutocompleteTextNoise(event):
+            return True
+
+        return self._eventIsBrowserUIAutocompleteSelectionNoise(event)
+
+    def _eventIsBrowserUIAutocompleteSelectionNoise(self, event):
         selection = ["object:selection-changed", "object:state-changed:selected"]
         if not event.type in selection:
             return False
@@ -4266,6 +4272,24 @@ class Utilities(script_utilities.Utilities):
 
         return False
 
+    def _eventIsBrowserUIAutocompleteTextNoise(self, event):
+        if not event.type.startswith("object:text-") \
+           or not orca_state.locusOfFocus \
+           or not self.isSingleLineAutocompleteEntry(event.source):
+            return False
+
+        roles = [pyatspi.ROLE_MENU_ITEM,
+                 pyatspi.ROLE_CHECK_MENU_ITEM,
+                 pyatspi.ROLE_RADIO_MENU_ITEM,
+                 pyatspi.ROLE_LIST_ITEM]
+
+        if orca_state.locusOfFocus.getRole() in roles \
+           and orca_state.locusOfFocus.getState().contains(pyatspi.STATE_SELECTABLE):
+            lastKey, mods = self.lastKeyAndModifiers()
+            return lastKey in ["Down", "Up"]
+
+        return False
+
     def eventIsBrowserUIPageSwitch(self, event):
         selection = ["object:selection-changed", "object:state-changed:selected"]
         if not event.type in selection:


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