WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Link vs Button for "Cancel"

for

From: Renato Iwashima
Date: Jan 8, 2018 2:35PM


> This does beg the question: Why not just use a <button>? If you decide to
go the button route for your "Cancel" action, then I suggest an HTML
<button>.

Primarily because it behaves like a link, it has its own URL and just
navigate the user away to a different page. If I make it a button, I'd need
to implement javascript to navigate the user to a different page which
seems unnecessary.

This is probably an issue with the visual design (it shouldn't look like a
button). But at this point it isn't a change I can make or push back. So I
was wondering if just going with a link would be sufficient enough, without
role="button".

On Mon, Jan 8, 2018 at 1:30 PM, Beranek, Nicholas via WebAIM-Forum <
<EMAIL REMOVED> > wrote:

> Yes, you will need to add keypress event handlers for Enter key and Space
> bar to activate the element with role="button". Also, if the element is not
> natively keyboard-focusable, then you'll need to add tabindex="0".
>
> This does beg the question: Why not just use a <button>? If you decide to
> go the button route for your "Cancel" action, then I suggest an HTML
> <button>.
>
> Nick Beranek
> Capital One
>
>