[orca] Web: Eliminate chattiness from newly-expanded/shown listbox



commit db193ab1f9c52510361771d35b16d65c2336f5fd
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Jun 22 11:57:57 2022 +0200

    Web: Eliminate chattiness from newly-expanded/shown listbox
    
    When a newly-expanded/shown listbox appears and focus is given to
    a child option, we generate ancestors. That presentation includes
    the name of the ancestor listbox.
    
    In some ARIA authoring, the name of the listbox is the same as the
    previously-focused object (e.g. a button or collapsed combobox).
    Repeating this name is unnecessarily chatty. This commit checks for
    that condition and returns early for the listbox name generation.
    
    Possibly fixes issue #252.

 src/orca/scripts/web/speech_generator.py | 7 +++++++
 src/orca/speech_generator.py             | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index 7dd12b93f..84521589e 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -326,6 +326,13 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         if priorObj and priorObj in self._script.utilities.labelsForObject(obj):
             return []
 
+        descendant = args.get("ancestorOf")
+        if descendant and priorObj and obj.name and obj.name == priorObj.name:
+            msg = "WEB: %s's ancestor %s has same name as priorObj %s. Not generating labelOrName." \
+                % (descendant, obj, priorObj)
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return []
+
         if self._script.utilities.isContentEditableWithEmbeddedObjects(obj) \
            or self._script.utilities.isDocument(obj):
             lastKey, mods = self._script.utilities.lastKeyAndModifiers()
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 2cb0990ca..40d116727 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -2112,7 +2112,7 @@ class SpeechGenerator(generator.Generator):
             count = ancestorRoles.count(altRole)
             self._overrideRole(altRole, args)
             result.append(self.generate(x, formatType='focused', role=altRole, leaving=leaving, count=count,
-                                        ancestorOf=obj))
+                                        ancestorOf=obj, priorObj=priorObj))
             self._restoreRole(altRole, args)
 
         if not leaving:


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