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

On Wed, Oct 21, 2009 at 8:11 AM, Shelley Powers <shelley.just@gmail.com> wrote:
> You have a very good point. Some very popular JS libraries do turn
> links into buttons. Many CSS tutorials tout this as an example of good
> CSS usage.
>
> If you go out and search on Google for "CSS link button" you get many
> tutorials, examples, etc, that focus on styling links as buttons. If
> you search on "JavaScript link button" you get many libraries that
> support this functionality.
>
> Frankly, I doubt that the HTML WG has enough clout to "evangelize" a
> change in this regard. Most people don't even know this is supposed to
> be "bad". Links and buttons: click, and something happens. JS
> developers don't tend to let a little thing like semantics get in the
> way. Some of the bigger libraries _might_ change their ways, but there
> is significant use of link as button in the wild -- we're in effect,
> telling people to "break" their web pages in order for them to be
> proper. We're also going counter to the many, many existing libraries,
> tutorials, etc that say, in effect, this is OK.
>
> If we're paving cow paths, and working to ensure accessibility, it
> seems to me that support for this very common usage should be taken
> into consideration. Perhaps something in the specification to the
> effect that such use is discouraged, but is not invalid.

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.)

Of course, if I'm just putting in some UI to hook a click handler
onto, then <button> wins out again.  I still use <a> sometimes,
though.

~TJ

Received on Wednesday, 21 October 2009 13:47:00 UTC