Sunday, November 9, 2008

Using .attr for ARIA in jQuery UI

Last week I found some time to hack on jQuery UI again. After talking to Scott we decided to pull the ariaRole, and ariaState API out of UI core, and put the browser normalization for ARIA right into the popular attr function where it belongs.

At this time, jQuery UI is a dependency for this enhanced attr function. We add the ARIA smarts in ui.core.js via proxy function, like this:
// proxy attr
var attr = $.attr;
$.attr = function () {
// if aria usage then normalize
// else
See the patch for the real deal. You might notice that we actually only proxy if a naughty browser/version is sniffed. Let's hope this ARIA normalization business won't grow too big and complex when the other browser ARIA implementations roll out. If we can keep it small and tight the attr enhancement really belongs in jQuery core. Or maybe it belongs there regardless? If you are doing Web2.0 development you're probably going to need it.

Here's an example of how one might use chaining to add the ARIA role of "tab" to all elements with a class "ui-accordion-header), and the ARIA state "aria-expanded=false", and add the ARIA role "tabpanel" to the next sibling of each (which happens to be the panels).
Working with Scott González and others on jQuery has been a very meaningful aspect of my Mozilla Foundation grant. Thanks Mozilla.

Thanks for reading.


Fastbet said...

If some one needs to be updated with hottest technologies then he must be pay a quick visit this web page and be up to date everyday. Agen Bola Online

Wawan Gado said...

Your style of presentation is very impressive. The meaningful contribution of your mind reflects on those people who are looking for new ideas and informations

Judi 338a online , ibcbet terpercaya

renan orola said...

Agen Bola Sbobet is legal, the trusted online betting company and attracts a lot of patrons, and there are numerous of games offers at online slots, and you will find t game which Sbobet Asia very famous on online betting option to bet.

renan orola said...

As years go by SEO become tough to compete of but because of years of experience our experts still manage and survive for any updates that have been hit by many websites. We have the strategies that is effective and give good progress to our clients. Outsource SEO Philippines

John Alert said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Online Training from India . or learn thru JavaScript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai