JAWS screen reader adding tabIndex of -1 to anchors with images
Asked Answered
M

2

5

I have three anchor tags, one with text inside and two with images with valid alt text. The anchor tag with text inside works fine with JAWS and is read properly. However, for some reason, with the anchors with the image inside, a tabIndex of -1 is being applied, which means they are being skipped over.

This is being tested in IE 9. Is there any reason why this should be occurring? Is there a way to prevent it?

Michaelson answered 26/3, 2013 at 15:20 Comment(1)
Do your image tags have alt and title attributes?Commutative
K
4

I had a similar issue with JAWS setting the tabindex of links to -1. This was with IE9 with JAWS 14.0

The problem ended up being caused by a setting in JAWS under "Web / HTML / PDFs" -> "Links" called "Filter Consecutive Duplicate Links". JAWS describes the feature as follows:

This option controls whether consecutive links that point to the same location, one graphical and one text, are filtered. When selected, only the text link is announced. This check box is selected by default.

For example, let's say you have a icon / text link pair that both do the same thing:

<a href="javascript:void(0)" onclick="test();">
    <img src="untitled.png" title="Test" alt="Test">
</a>
<a href="javascript:void(0)" onclick="test();">TEST</a>

With the setting checked JAWS will remove the image from the tab order leaving only the text link like this:

<a tabindex="-1" href="javascript:void(0)" onclick="test();">
    <img src="untitled.png" title="Test" alt="Test">
</a>
<a href="javascript:void(0)" onclick="test();">TEST</a>

From my experience and some basic tests I believe this only applies when an image link is followed by a duplicate text link and not vice versa. Also it applies to any duplicate image link following the image / text pair.

The problem I ran into was that JAWS only seemed to compare the href attribute and did not take into account other attributes such as onclick or onkeydown. Pair this up with the duplicate removal applying to any image links following the initial image / text link pair and you can end up with a case where the an image link following a image/ text link pair gets when it should not. Example:

<a href="javascript:void(0)" onclick="test();">
    <img src="untitled.png" title="Test" alt="Test">
</a>

<a href="javascript:void(0)" onclick="test();">TEST</a>

<a href='javascript:void(0)' onclick="dontTest();">
    <img src="untitled2.png" title="Test" alt="Test">
</a>

Result:

<a tabindex="-1" href="javascript:void(0)" onclick="test();">
    <img src="untitled.png" title="Test" alt="Test">
</a>

<a href="javascript:void(0)" onclick="test();">TEST</a>

<a tabindex="-1" href='javascript:void(0)' onclick="dontTest();">
    <img src="untitled2.png" title="Test" alt="Test">
</a>

Note: the fact that the href is set to javascript:void(0) is purely coincidental. This behavior should be reproducible using any value for the href as long as the value is the same for all the links.

Hope this helps someone.

Karlsbad answered 9/4, 2013 at 20:59 Comment(2)
JAWS made it a nightmare!Metric
+1 Glad to find this and the answer above. Was going nuts with that tabindex=-1. I don't know if the solution will apply to my problem, but atleast having the knowledge of where the issue is coming from is great help.Uncircumcision
C
3

JAWS automatically add tabindex="-1" to anchor tags which have href="javascript:void(0)". I used href="#" to solve the same problem as yours.

Cilice answered 9/4, 2013 at 4:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.