[orca] Handle links whose sole content is an image with alt=""
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Handle links whose sole content is an image with alt=""
- Date: Sat, 23 May 2020 18:51:42 +0000 (UTC)
commit a61e455ac724eadccca3b0f98ef853661be709b4
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat May 23 14:48:44 2020 -0400
Handle links whose sole content is an image with alt=""
The W3C provides guidance to authors saying that they can use alt=""
on an image, including in a link, as a way to get screen readers to
ignore that image. Ideally, this ignoring would be done by the user
agent -- and is for Chrome/Chromium. But Gecko includes the useless
image in the accessibility tree, forcing screen readers to do the
pruning themselves. In addition, when a link whose sole content is
an image gets focus, Gecko emits a caret-moved event for the offset
which we're supposed to ignore. As a consequence of this event, Orca
was looking for the next presentable location. This can be a mistake
if the next presentable location happens to be another link that the
user will tab to. Therefore:
* Ignore images with alt="" that are inside links
* Don't look for the next presentable location when we get a caret-
moved event for something which we're supposed to pretend doesn't
exist.
src/orca/scripts/web/script_utilities.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 16501f18a..f67e7171b 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3766,7 +3766,7 @@ class Utilities(script_utilities.Utilities):
rv = False
if rv and obj.getState().contains(pyatspi.STATE_FOCUSABLE):
rv = False
- if rv and obj.parent.getRole() == pyatspi.ROLE_LINK:
+ if rv and obj.parent.getRole() == pyatspi.ROLE_LINK and not self.hasExplicitName(obj):
uri = self.uri(obj.parent)
if uri and not uri.startswith('javascript'):
rv = False
@@ -4792,11 +4792,9 @@ class Utilities(script_utilities.Utilities):
return obj, offset + 1
if not self._canHaveCaretContext(child):
- nextObj, nextOffset = self.nextContext(obj, offset)
- msg = "WEB: First caret context for %s, %i is %s, %i (child cannot be context)" % \
- (obj, offset, nextObj, nextOffset)
+ msg = "WEB: Child cannot be context. Returning %s, %i unchanged." % (obj, offset)
debug.println(debug.LEVEL_INFO, msg, True)
- return nextObj, nextOffset
+ return obj, offset
msg = "WEB: Looking in child %s for first caret context for %s, %i" % (child, obj, offset)
debug.println(debug.LEVEL_INFO, msg, True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]