Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can aria-disabled only be applied to a focusable element? Doesn't it also apply to child elements?

I've created a page using Bootstrap with a standard layout of next and previous page links. On the first page, I disable the 'previous page' link as follows:

<div role="navigation">
  <ul class="pager">
    <li class="previous disabled" aria-disabled="true">
      <a href="#">Previous page</a>
    </li>
    <li class="next">
      <a href="search.php?page=2">Next page</a>
    </li>
  </ul>
</div>

It seems like screen readers (JAWS, NVDA and VoiceOver) aren't seeing the aria-disabled="true" flag, even though the W3C WAI-ARIA spec states:

The state of being disabled applies to the current element and all focusable descendant elements of the element on which the aria-disabled attribute is applied.

If I add aria-disabled="true" to the link:

    ...
    <li class="previous disabled" aria-disabled="true">
      <a href="#" aria-disabled="true">Previous page</a>
    </li>
    ...

then it works as I'd hoped, with the screen reader describing the link as 'disabled'.

Am I misunderstanding the WAI-ARIA spec, or is this a 'feature' of screen reader implementation? In his comment on 'How do i tell a screen reader that a link is disabled', Bryan Garaventa mentions:

... the use of aria-disabled works best for elements that have a defined role, such as role=button.

Can aria-disabled only be applied to focusable elements?

like image 664
oedwards Avatar asked May 13 '15 23:05

oedwards


1 Answers

With JAWS 16, both IE and Chrome have the problem you describe, but FF 38 works correctly (not sure about previous versions of FF). When I tab to the link where the <li> has aria-disabled="true" and there's not an aria-disabled="true" on the <a>, FF 38 and JAWS 16 says "previous page unavailable link".

It doesn't actually prevent me from activating that link, because that's not what aria-disabled is for, but JAWS seems to know the child element is disabled because the parent is disabled.

It also works in VoiceOver on iOS 8.3 on an ipad2. VO says "previous page dimmed link"

This might be a case where you have to decide whether to keep the properly formatted html and let the user agent fix the bug, or if you should try to code around the problem, which in your case was putting the aria-disabled on the link itself.

like image 183
slugolicious Avatar answered Sep 19 '22 12:09

slugolicious