[orca] Flat review: Ensure more objects with info get presented, esp. for web apps
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Flat review: Ensure more objects with info get presented, esp. for web apps
- Date: Wed, 15 Apr 2020 16:17:18 +0000 (UTC)
commit 53df2e8807dbec4e62f2d3af0fbbf07b9ac7d065
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Apr 15 12:10:38 2020 -0400
Flat review: Ensure more objects with info get presented, esp. for web apps
* Accept description as valid reason for inclusion
* Filter out links which lack name, description, and text. This will
cause us to use the named parent which, sadly, might be a div with
a name or tooltip/description. But at least we'll present *something*
* Ensure we generate names for text block elements in web content when
in flat review. This is needed to cause the aforementioned "something"
to be presented.
src/orca/flat_review.py | 4 ++--
src/orca/script_utilities.py | 11 +++++++----
src/orca/scripts/web/speech_generator.py | 3 ++-
3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/flat_review.py b/src/orca/flat_review.py
index 033775fc5..f38a10f9a 100644
--- a/src/orca/flat_review.py
+++ b/src/orca/flat_review.py
@@ -615,7 +615,7 @@ class Context:
lowerMin = lowerMid
lowerMid = int((lowerMax - lowerMin) / 2) + lowerMin
- msg = "FLAT REVIEW: Gettings lines for %s offsets %i-%i" % (accessible, upperMin, lowerMax)
+ msg = "FLAT REVIEW: Getting lines for %s offsets %i-%i" % (accessible, upperMin, lowerMax)
debug.println(debug.LEVEL_INFO, msg, True)
lines = self._getLines(accessible, upperMin, lowerMax)
@@ -697,7 +697,7 @@ class Context:
string = ""
redundant = [pyatspi.ROLE_TABLE_ROW]
if role not in redundant:
- string = self.script.speechGenerator.getName(accessible)
+ string = self.script.speechGenerator.getName(accessible, inFlatReview=True)
useless = [pyatspi.ROLE_TABLE_CELL, pyatspi.ROLE_LABEL]
if not string and role not in useless:
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 750cf3a43..5197741e7 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2083,9 +2083,10 @@ class Utilities:
return visibleCells
objects = []
- if role in [pyatspi.ROLE_PAGE_TAB, pyatspi.ROLE_IMAGE] and root.name:
+ hasNameOrDescription = (root.name or root.description)
+ if role in [pyatspi.ROLE_PAGE_TAB, pyatspi.ROLE_IMAGE] and hasNameOrDescription:
objects.append(root)
- elif "Text" in pyatspi.listInterfaces(root) and re.findall("\w+", root.queryText().getText(0, -1)):
+ elif "Text" in interfaces and re.match("\w+", root.queryText().getText(0, -1)):
objects.append(root)
for child in root:
@@ -2098,14 +2099,16 @@ class Utilities:
if objects:
return objects
- containers = [pyatspi.ROLE_FILLER,
+ containers = [pyatspi.ROLE_CANVAS,
+ pyatspi.ROLE_FILLER,
pyatspi.ROLE_IMAGE,
+ pyatspi.ROLE_LINK,
pyatspi.ROLE_LIST_BOX,
pyatspi.ROLE_PANEL,
pyatspi.ROLE_SECTION,
pyatspi.ROLE_SCROLL_PANE,
pyatspi.ROLE_VIEWPORT]
- if role in containers:
+ if role in containers and not hasNameOrDescription:
return []
return [root]
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index a58d72a76..0cc8a46eb 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -337,7 +337,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
if self._script.utilities.isTextBlockElement(obj) \
and not self._script.utilities.isLandmark(obj) \
- and not self._script.utilities.isDPub(obj):
+ and not self._script.utilities.isDPub(obj) \
+ and not args.get('inFlatReview'):
return []
role = args.get('role', obj.getRole())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]