[orca/gnome-3-36] Fix false positive resulting from author using aria-labelledby to label itself
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-36] Fix false positive resulting from author using aria-labelledby to label itself
- Date: Tue, 9 Jun 2020 15:36:45 +0000 (UTC)
commit a3dd166b1c92545df64f5ec6f26097a5b96ebda0
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Jun 9 11:31:41 2020 -0400
Fix false positive resulting from author using aria-labelledby to label itself
If an author uses aria-labelledby on a partially-offscreen element pointing
to itself, we might skip over the object due to falsely believing it is an
off-screen label. Therefore remove any self-referential "labels" before doing
this check.
src/orca/scripts/web/script_utilities.py | 35 ++++++++++++++++----------------
1 file changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 695f84fbd..958ef61da 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2936,22 +2936,16 @@ class Utilities(script_utilities.Utilities):
return rv
rv = False
- isLabelFor = lambda x: x.getRelationType() == pyatspi.RELATION_LABEL_FOR
- try:
- relationSet = obj.getRelationSet()
- except:
- pass
- else:
- relations = list(filter(isLabelFor, relationSet))
- if relations:
- try:
- text = obj.queryText()
- end = text.characterCount
- except:
- end = 1
- x, y, width, height = self.getExtents(obj, 0, end)
- if x < 0 or y < 0:
- rv = True
+ targets = self.labelTargets(obj)
+ if targets:
+ try:
+ text = obj.queryText()
+ end = text.characterCount
+ except:
+ end = 1
+ x, y, width, height = self.getExtents(obj, 0, end)
+ if x < 0 or y < 0:
+ rv = True
self._isOffScreenLabel[hash(obj)] = rv
return rv
@@ -3054,9 +3048,14 @@ class Utilities(script_utilities.Utilities):
return []
r = relations[0]
- rv = [r.getTarget(i) for i in range(r.getNTargets())]
- rv = [hash(x) for x in rv if x is not None]
+ rv = set([r.getTarget(i) for i in range(r.getNTargets())])
+ if obj in rv:
+ msg = 'WARNING: %s claims to be a label for itself' % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ rv.remove(obj)
+
+ rv = [hash(x) for x in rv if x is not None]
self._labelTargets[hash(obj)] = rv
return rv
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]