Re: ARIA roles added to the a element should be conforming in HTML5.

2009/10/21 Tab Atkins Jr. <>:
> Sometimes making a link into a button seems to be the correct choice.
> If I want the styling of a button, but I want clicking it to just
> navigate you to another page, I can restyle an <a> to look like a
> button, or I can insert a <form action><button type=submit></></> and
> style the form away.  The latter feels like a dirty hack.  (I've used
> it, once, but only at the very very beginning of my webdev career when
> I didn't fully understand how urls and query params interacted.)

In that case you are visually styling a link to resemble a button, but
its functionality is still that of a link, so it would be incorrect to
give it a role of "button": the role describes what something does,
not what it looks like.

Similarly, if I were to lose my mind and produce something like:

<button type="button"
onclick="self.location.href=''">Go to</button>

then it would be appropriate for me to give the button an ARIA role of
"link", as it is acting like a link and not a button.


Nick Fitzsimons

Received on Wednesday, 21 October 2009 14:45:49 UTC