WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Links and Spacebar


From: Birkir R. Gunnarsson
Date: Feb 3, 2020 10:59AM

Agree with Steve
If you repurpose a link as a button you need Javascript that checks if
the spacebar is pressed and executes the onclick event on the link if
it is pressed.
You can tie the Javascript selectors to all elements with
role="button" (something you have to add to links anyway when you
repurpose them as buttons).
Note: A screen reader user doesn't care, because most screen readers
are configured to execute the onclick event if either the enter or
spacebar are pressed when in browse mode (this can be changed in
screen reader settings and this does not apply in application/forms
I'm not implying you are only asking with the screen reader usre
experience in mind (accessibility is about a lot more than screen
reader users, as we all know and agree) but this behavior is specific
to screen readers and people testing webpages for keyboarde
accessibility often fall into the trap of having screen readers
running when they do it.
gives a confusing

On 2/3/20, Steve Green < <EMAIL REMOVED> > wrote:
> On all Windows browsers (and maybe Mac, but I have not checked), the
> spacebar scrolls the page down unless the focus is on certain elements such
> as checkboxes and buttons. That said, I have never seen anyone do this in 15
> years of user testing.
> If all links responded to the spacebar I don't think anyone would notice.
> Nevertheless, I am not keen on making exceptions like this, so I would
> advocate against it. It should be easy to only have the spacebar work with
> links that are styled as buttons.
> Steve Green
> Managing Director
> Test Partners Ltd
> -----Original Message-----
> From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of
> Marshall Sunnes
> Sent: 03 February 2020 16:32
> To: WebAIM Discussion List < <EMAIL REMOVED> >
> Subject: [WebAIM] Links and Spacebar
> *Question*: Is it problematic to allow activation of links with the
> Spacebar, in addition to Enter?
> *More information*: The basic issue I find is that if a user sees something
> that looks like a button, then it should work with the spacebar for
> keyboard-only users.
> If an app were to correctly identify elements as link or button based on the
> description listed in the ARIA Authoring Practices 1.1
> <https://www.w3.org/TR/wai-aria-practices-1.1/#link>, but visually styled
> links to look like buttons, then would it be an easy compromise to request
> they simply make all links able to activated with spacebar? Does that
> interfere with any known AT or user experience? Or is that misguided, and
> the dev teams need to handle links that look like buttons on a case-by-case
> basis?
> Best,
> Marshall
> --
> *Marshall Sunnes*
> *Senior Digital Accessibility Specialist* NYU IT
> <https://www.nyu.edu/life/information-technology.html>
> New York University
> Phone: (212) 998 4417 <+12129984417>
> > > http://webaim.org/discussion/archives
> > > > > >

Work hard. Have fun. Make history.