WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Links vs. Buttons

for

From: Benjamin Hawkes-Lewis
Date: Jun 5, 2012 3:26AM


On Mon, Jun 4, 2012 at 4:15 PM, Heidi Jungel < <EMAIL REMOVED> > wrote:
> I find that many sites abuse the use of links and use links for everything- even button type action. I have often used the following quote:
>
> "Links are for navigation (I.e. To another section of a page or another page). Buttons are for actions"
>
> However, I am a getting a bit of a push back on this. What are your thoughts on this? Are sites abusing links?

Yes absolutely, though this is mostly a lost cause thanks to abuse on
popular sites like Facebook.

In theory, a@href should be reserved for navigational hyperlinks, but
this distinction has been blurred in all sorts of ways.

Addresses can represent imperative actions using the javascript: scheme:

http://tools.ietf.org/html/draft-hoehrmann-javascript-scheme

or by using hash bangs:

http://www.w3.org/2001/tag/2011/01/HashInURI-20110115

User agents may handle links to certain resources in ways that may
surprise end-users in how different they are from other links,
triggering downloads, opening them in external applications, composing
a new message in an email client, etc.

Servers should avoid making GET actions on resources non-idempotent or
perform destructive actions, but they don't always do this. There have
been high-profile cases where following a link triggered a deletion
from a database:

http://radar.oreilly.com/archives/2005/05/google-web-acce-1.html

At the semantic layer, hyperlinks can be represented to accessibility
clients as buttons and vice versa using ARIA annotations.

At the styling level, hyperlinks can be styled to look like buttons,
<input> and <button> elements can be styled to look like hyperlinks.

At the behavioral layer, hyperlinks can be reprogrammed to perform
actions rather than navigation.

I think there are some tests to see if you are using hyperlink widgets
correctly:

1. If you right-click the link to get the context menu, you'll be
offered options like bookmarking the link and opening the link in a
new tab. Do these secondary actions work? If you go to the bookmark,
do you get content appropriately described by the link text?

2. If you follow the link and this results in a navigation, can you go
back, click it again, and still get content appropriately described by
the link text?

In other words, does your use of a@href break the actions (primary and
secondary) that user agents expose for hyperlink widgets?

--
Benjamin Hawkes-Lewis