WebAIM - Web Accessibility In Mind

E-mail List Archives

Detecting keyboard usage


From: Alastair Campbell
Date: Sep 17, 2013 6:10AM

Hi everyone,

I've an odd issue with accessibalising a carousel. Yes, yes, I know we
shouldn't use them, that's not an option here.

It already has a visible pause button, alt text etc etc.

The issue is that I would like it to pause automatically when a keyboard
user is interacting with the page. (Again, I know that isn't ideal, but it
"has to" auto-play.)

That is straightforward to do with non-screen reader usage, you can detect
use of the tab key and pause it.

I thought detecting focus would be ideal, and with a little experimentation:

I can detect "focusin", and it works with people tabbing, and with

However, in NVDA (due to the virtual cursor approach I assume) the event is
not triggered, i assume it would be the same for Jaws.

It is a similar story for use of the arrow keys, they don't get passed on.
Does anyone know of a reliable way of detecting keyboard usage? (And why
doesn't this impact ARIA widgets?)