3
votes

So I was able to get my page working just fine with the NDVA screen reader, however, when testing in JAWS, it tabs to the span, but doesn't read the text.

<span tabindex="0" title="whatever">whatever</span>

UPDATE:

  • What I am trying to achieve is a I have a few elements which expand/collapse certain sections of the site I'm building. These functional elements, however are not links.

  • Reponse to @discojoe (thanks for the response)

  • Adding a TABINDEX="0" attribute will insert the SPAN/DIV element into tabbing list in natural order (whereas by default, they're usually not added to the tabbing list). This allows screen readers to tab to that element, and is working just fine. Specifically, my problems is JAWS will just tab to that element, it just doesn't read it.
  • I agree, using TABINDEX="n" (where n > 0) is a bad thing which messes with the natural order of the tabbing list, and I am not doing that.
  • Also, you can use TABINDEX="-1" to remove an element from the tabbing list if it's placed in there by default (example an A or INPUT tag).
  • I have already tried using tags, however, when user hits enter on this link (to trigger the onclick event), it does something (not quite reloading, but kinda re-initializing) to the page which delays the animation associated with that element. I find that to be a bad experience to both normal and disabled users.
  • using the # tag in the A tag adds the hash tag to the page title in IE.
  • Additionally, using A tags makes the screen reader read out "LINK" before/after each element, and since they're not actually links, I feel this is negative impact on accessibility.
3

3 Answers

2
votes

I would first want to know why you are using a span element and not a standard a href element? What is it you are wanting to achieve? It may help if you can provide more context\code.

I've just tried this and am getting the same issue; whilst I can arrow through the document and have a span read out to me, I cannot then tab to it and have it read out.

Using something instead like

<a href="#" onclick="javascript: return false;">Whatever</a> 

works fine.

There are additional problems around using the tabindex attribute, specifally for keyboard users. On a page that users the tabindex attribute, the tab focus order will first of all go through all of the elements with tabindex specified, and then run through all the elements without it, in source code order.

A good general rule is to either use tabindex for all keyboard accessible elements, or for none of them, to get around this problem.

I realise in this case, you are likely using tabindex to just provide keyboard accessibility for this one item, so this issue may be irrelavant if you use the a href approach mentioned, but I wanted to mention it for completeness

0
votes

First of all, reading "link" before such elements does not impact accessibility in a negative way, I'd say, it's quite opposite: you warn the user that he/she can click the element in such a manner.
Here you have a couple options:

  1. Use quite a lot of ARIA: add the link role to your span elements, properly code your expanding/collapsing menus (with corresponding ARIA roles and states).
  2. Use <a href="#" as suggested by @discojoe but add event.preventDefault() (in jQuery) or return false; (in vanilla) so the page would not reinitialize.

If you need more suggestions, please post some code or a link to your page.

0
votes

Use anchor tag for screen reading simple text related works. You can simply do :-

<a href="javascript:void(0);" title="What you want to be read by jaws></a>

That's it. I tested it with JAWS.