WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Must elements with onclick handlers be focusable?

for

From: Birkir R. Gunnarsson
Date: Jul 22, 2014 6:20AM


onclick events on non-focusable elements (along with or hover events
on focusable ones) can be one of the most significant barriers to web
accessibility, when the action is crusial to achieving the end user
goals.
Just to name a recent example. I was unable to contact Groupon via an
online feedback form because the only way to pop up their "contact us"
menu is by hovering the mouse over a link that when double clicked
does something completely different.
I also recently saw a banking website (not in the U.S. or Canada),
that implemented all its user actions as anchors with no href
attribute but attached onclick events, which completely prevents
keyboard-only end users from being able to carry out anything except
logging in.
My point is that these types of constructs, when the onclick event
does something significant or meaningful, are one of the worst
accessibility boo boos, so any audit, be it manual or automated, has
to be on the lookout for these types of issues.

So I support the need for them to always alert the end user of these
types of situations.
Whether they should automatically be flagged as violations necessarily
is a different matter altogether.
Basically, we have to ask ourselves, can we make these tools smarter?
Can they detect and interpret Javascript patterns and understand the
purpose of the onclick functionality?
Tall order, but it is conceivable that certain patterns of Javascript
could be recognized.
Cheers.
-B


On 7/22/14, Patrick H. Lauke < <EMAIL REMOVED> > wrote:
> On 22/07/2014 10:59, Alastair Campbell wrote:
>> I've been using a lot of tools recently, for obvious reasons[1], and
>> quite
>> a few seem to over-report this issue:
>> "Elements with onclick handlers must be focusable"
> [...]
>> Do other people consider this a false positive?
>
> It depends on the exact structures used. In general, it seems a very
> facile simplification to generalise "if there's onclick it must be
> focusable" ... it's not something that can be easily machine-tested, so
> tools shouldn't pretend that they can.
>
> P
> --
> Patrick H. Lauke
>
> www.splintered.co.uk | https://github.com/patrickhlauke
> http://flickr.com/photos/redux/ | http://redux.deviantart.com
> twitter: @patrick_h_lauke | skype: patrick_h_lauke
> > > >


--
Work hard. Have fun. Make history.