WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Buttons and links: navigating a mixed list

for

From: Nick Bromley
Date: Aug 24, 2023 1:17PM


I very often see <a role="button"> and try and get them refactored where possible.

I've been mulling this over throughout the day, reading various other opinions and discovering a few more resource types that either download directly or open in a new tab, meaning most resources open through link-like behaviour. As a result, I've also been coming round to the idea of making everything a proper link.

The HTML-based activities launch in an iframe embedded in a full-screen overlay that pops up.

-----Original Message-----
From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of glen walker
Sent: Thursday, August 24, 2023 6:54 PM
To: WebAIM Discussion List < <EMAIL REMOVED> >
Subject: Re: [WebAIM] Buttons and links: navigating a mixed list

I've never understood why anyone would use <a role="button">. I've seen it sometimes because the designer/developer liked the look/style of a link.
In that case, a real <button> should be used but just style it with CSS to get the look you want.

Remember that adding aria attributes does not give you any "behavior".
Slapping a role="button" on a link will not make the link work properly when SPACE is pressed unless you add some javascript. Without handling the keyboard event, SPACE will just scroll the page instead of selecting the link/button.

To be consistent, I think links should be used for all the resources. The link might navigate to a new page or it might download a document. Those are both acceptable behaviors for a link.

I'm not sure what "launches the resource directly if it is an embedded HTML-based activity" means. Do you get an embedded iframe within the page?