WebAIM - Web Accessibility In Mind

E-mail List Archives

Must elements with onclick handlers be focusable?

for

From: Alastair Campbell
Date: Jul 22, 2014 3:59AM


Hi,

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"

However, there seem to be quite a few situations where this is not an
issue. For example, if this is a shortened version of the HTML markup:

<div>
<h2><a href="valid/page.html">Heading of story</a></h2>
<img alt="nice description src="image.jpg">
<p>Excerpt from the story.</p>
</div>

If you then use JavaScript to make the whole div clickable based on the
heading-link, that is a nice feature that increases the hit-area
dramatically, and prevents making multiple links to the same target.

IMHO the keyboard experience is no different, and can be better as you can
make the whole box visually different as you tab through.

Do other people consider this a false positive?

-Alastair

1] http://www.accessibilityassociation.org/content.asp?contentid=183

PS. I know that in HTML5 you could wrap the whole thing in a link, but that
breaks down if you then have a different link in the paragraph, but it's
fine with JavaScript.