Adding ARIA roles and states to an Accordion widget

Sunday Jul 27 2008

I've been working on adding to my YUI Accordion widget for better . Since documentation is still a bit hard to find and what's there can be a bit ambiguous at times I figured I'd write down what I've done so far and ask you all to comment on it in case you think anything can be improved. Here goes:

Roles

I felt that there should really be roles for an Accordion View but... there aren't! Therefore I had to pick the closest match. I decided to go for the following roles.

  • The UL element that represents the entire accordion gets role="tablist"

    My reasoning behind it is that in my opinion an Accordion is closest to a tablist. Definitely closer than menu which I had at first.

  • The bars that open a pane have role="tab". This corresponds with the role of the parent element and again, it kinda makes sense I think.

  • Finally, the panel revealed by each accordion subcomponent has role="tabpanel". Again, in sync with the previous two roles.

I think it would be better if there were roles for Accordions because they occur very frequently. This is however the best I could come up with for now.

States

I used a handful of states. Again, a bit of personal judgement is involved as there don't seem to be any strict rules.

  • For the bars that open a tab panel I've been considering aria-selected and aria-pressed. The latter seemed closest to something that has a kind of a toggle behaviour which is why I went with aria-pressed.

  • For the 'tabs' I used the state aria-hidden which indicates state change for any panel.

Finally I created a relationship between each panel and the bar that toggles it by using aria-labelledby="id_of_the_bar"

All this is currently implemented in my development version of the Accordion which can be seen here at the moment of writing. Fairly soon (I hope) it will replace the current version so if you bump into this post later and don't find it under the first link, the last one should work.

Please do comment!

Dark Matter Pro: a premium photoblog template.

Affiliate program available

bookmarking

Commentary

Join the discussion! Leave a comment through the comment form below!

Got something to add to this?

Feel free to leave a comment on this site. You can use Textile and Emoticons. Your email address is only used to show a gravatar. Please stay on-topic and use common decency. Spammers will be shot in front of a live studio audience.

If you plan on posting code, use pastebin please and post a URL to the code. The comment processing doesn't deal very well with code. Sorry for the inconvenience.

Human comment spammers: don't bother posting your crap here. Comments are moderated and I won't let any of your shit through.

Remember personal info?
Yes
No

Trackbacks

If you have an interesting related post on your own site you can leave a trackback. As they say: 'a little AJAX a day keeps the spammers away' which is why you'll have to click below to generate a trackback key. The key will be valid for 15 minutes and can be used only once.

 

  • Featured Links
RockySomewhere near the Orion NebulaBookalicio.usGolden Gate BridgeThames River BankJackie and mePimpin' it