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 8:45AM


There is no single magic solution to this problem, it depends on what
the onclick event does.
I like how Marco Zehe describes the problem an the basic elements of
the solution:
http://www.marcozehe.de/2013/04/24/easy-aria-tip-6-making-clickables-accessible/

But sometimes, when the onclick event triggers pop up menus other aria
properties such as aria-haspopup/aria-expanded need to be added to the
mix.

When the onclick event does not activate a link or a button the
recommendations may not apply and other methods need to be used to
address the specific issue.
Sometimes nothing needs to be done (such as in the instances described
on this thread).
Accessibility is an interesting field.
Cheers
-Birkir



On 7/22/14, Patrick H. Lauke < <EMAIL REMOVED> > wrote:
> On 22/07/2014 15:00, Stanzel, Susan - FSA, Kansas City, MO wrote:
>> Good morning Listers,
>>
>> Can anyone point me to something which would tell me the proper way to fix
>> such problems. I am now confused whether CSS or JavaScript is the right
>> solution. We are getting WorldSpace and I am sure I will be asked how to
>> fix such problems.
>
> Just as there is no single pattern that can be recognised reliably,
> there is also no single solution. In short, there has to be some way to
> use the keyboard and also trigger the same behavior that would happen if
> the user tapped with a finger/clicked with a mouse on a non-focusable
> element with a click handler (note it doesn't necessarily have to be an
> onclick attribute...it could be an event listener added programmatically
> to the element, or even - if event delegation is used, such as in jQuery
> etc - to a parent/ancestor only).
>
> One solution *could* be to add tabindex="0" to the element in question,
> making it focusable (but then also adding relevant role="..." attribute
> and attaching any other default behavior expected for an element of that
> role). Another may be to simply have another focusable element (which
> may be a child element, or a completely separate element somewhere else
> in the document) that does the same thing. Plus about 100 other
> variations on this theme...
>
> P
>
>> Susie Stanzel
>>
>>