[orca] Ensure we announce role and content of elements with ARIA's separator role



commit 384ae5766b8c1ffb593d8b6da93353b6c4e8ee9a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon May 4 15:47:39 2020 -0400

    Ensure we announce role and content of elements with ARIA's separator role
    
    In the case of Chromium, we were announcing the role, but not checking
    for text content; in the case of Firefox, we were finding a child of the
    separator with text but not then presenting the ancestor separator. This
    fix causes us to handle both cases.
    
    Also, don't present values for non-focused separators. Non-focusable
    separators are not supposed to implement the value interface. But if an
    author slaps a tabindex value of -1 on them, then user agents seem to
    treat them as focusable and expose the value interface on them, complete
    with default values which are likely useless noise given the object is
    not serving as a widget.

 src/orca/formatting.py                   | 4 ++++
 src/orca/generator.py                    | 3 +++
 src/orca/scripts/web/script_utilities.py | 2 ++
 3 files changed, 9 insertions(+)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 68e3a84bf..81ae2cac9 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -439,6 +439,10 @@ formatting = {
             'unfocused': 'labelAndName + (displayedText or value) + roleName + required + pause + invalid + 
availability + ' + MNEMONIC,
             'basicWhereAmI': 'label + roleName + name + (displayedText or value) + ' + MNEMONIC + ' + 
accelerator + required + pause + invalid'
             },
+        pyatspi.ROLE_SEPARATOR: {
+            'focused': 'roleName',
+            'unfocused': 'roleName + (labelOrName or displayedText or value) + ' + MNEMONIC,
+            },
         pyatspi.ROLE_SPLIT_PANE: {
             'focused': 'value',
             'unfocused': 'labelAndName + roleName + value + availability + ' + MNEMONIC,
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 203e626a7..b8e350f92 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -1038,6 +1038,9 @@ class Generator:
             value = self._script.utilities.getComboBoxValue(obj)
             return [value]
 
+        if role == pyatspi.ROLE_SEPARATOR and not obj.getState().contains(pyatspi.STATE_FOCUSED):
+            return []
+
         return [self._script.utilities.textForValue(obj)]
 
     #####################################################################
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 45c021d51..970297c4b 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2919,6 +2919,8 @@ class Utilities(script_utilities.Utilities):
             rv = False
         elif role in [pyatspi.ROLE_COLUMN_HEADER, pyatspi.ROLE_ROW_HEADER]:
             rv = False
+        elif role == pyatspi.ROLE_SEPARATOR:
+            rv = False
         elif role == pyatspi.ROLE_PANEL:
             rv = not self.hasExplicitName(obj)
         elif role == pyatspi.ROLE_TABLE_ROW and not state.contains(pyatspi.STATE_EXPANDABLE):


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