Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49199

Adding ARIA roles via Javascript

$
0
0

I'm using the Password Policy module to enforce strong passwords. When a user changes their password, the module displays a password strength indicator via Javascript. I'd like to add the ARIA live region role to the span that contains the strength indication and error message.

Hacking the Javascript is pretty simple. I'd like to consider the options for doing this the "best" way.

As I see it, I have two options. The first would be to redo a chunk of the module so that the strength indicator is generated in PHP and displayed dynamically by Javascript. Then the PHP code that creates the indicators would be made themeable. That would then allow me to create theme code that overrides the default span and create one that has the roles I need.

My second option would be to create some Javascript code in my own theme that runs after the code in Password Policy. This Javascript would add the roles I need dynamically. I don't know if JAWS or other screen readers would recognize the ARIA roles if they were added this way. Of course testing this is compounded by the variety of ways roles could be specified.

Any suggestions?


Viewing all articles
Browse latest Browse all 49199

Trending Articles