[orca] Web: Don't insist that labels for a given object must have role label



commit a8fa46117368815002946adcf1dd9dad9ab86fd6
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Dec 4 13:43:58 2020 +0100

    Web: Don't insist that labels for a given object must have role label
    
    That insistence appears to be legacy code related to trying to guess
    labels for badly-authored native HTML forms. And filtering out other
    roles makes it harder to identify other elements serving as labels
    which we should not repeat. For instance, if the user is on a heading
    and then arrows down into a region with aria-labelledby pointing to
    that heading, we do not want to present that name (heading) again.
    Fixing that chattiness will be done in a separate commit.

 src/orca/scripts/web/script_utilities.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9b5f2f79d..5ddd843ca 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -99,7 +99,7 @@ class Utilities(script_utilities.Utilities):
         self._isNonNavigableEmbeddedDocument = {}
         self._isParentOfNullChild = {}
         self._inferredLabels = {}
-        self._actualLabels = {}
+        self._labelsForObject = {}
         self._labelTargets = {}
         self._displayedLabelText = {}
         self._mimeType = {}
@@ -172,7 +172,7 @@ class Utilities(script_utilities.Utilities):
         self._isNonNavigableEmbeddedDocument = {}
         self._isParentOfNullChild = {}
         self._inferredLabels = {}
-        self._actualLabels = {}
+        self._labelsForObject = {}
         self._labelTargets = {}
         self._displayedLabelText = {}
         self._mimeType = {}
@@ -4092,7 +4092,7 @@ class Utilities(script_utilities.Utilities):
         if not obj:
             return []
 
-        rv = self._actualLabels.get(hash(obj))
+        rv = self._labelsForObject.get(hash(obj))
         if rv is not None:
             return rv
 
@@ -4100,8 +4100,7 @@ class Utilities(script_utilities.Utilities):
         if not self.inDocumentContent(obj):
             return rv
 
-        rv = list(filter(lambda x: x and x.getRole() == pyatspi.ROLE_LABEL, rv))
-        self._actualLabels[hash(obj)] = rv
+        self._labelsForObject[hash(obj)] = rv
         return rv
 
     def isSpinnerEntry(self, obj):


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