WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Does this Javascript bring focus to expanded content?

for

From: Jared Smith
Date: Feb 8, 2012 12:54PM


On Wed, Feb 8, 2012 at 12:29 PM, Angela French wrote:
>  Are you saying all I have to do is add the aria-expanded attribute to my content divs to make them perceivable to screen readers?

Kind of. To correct your statement, the aria-expanded attribute goes
on the link that does the expanding, not on the content that is
revealed. You've done this correctly in your example.

If the text is in the page, it's "perceivable" - the key is informing
the user of the functionality of the links/buttons (that they'll
reveal or hide content) and the current state of that content
(expanded or not). Your example does precisely this for screen reader
users, except...

... there's a issue with your scripting - it needs to be modified so
it changes the aria-expanded state of the link that has been
activated. Your code has multiple links with id="expandlink", so the
aria attribute is only updated on the first link.

Jared