Re: [whatwg/dom] [Proposal] Add EventTarget.getEventListeners() (#412)

Here's another use case I didn't see mentioned here: accessibility auditing tools currently have no API to inspect event listeners, so we can't point out inaccessible UI controls. It's a huge gap in what we can automate for WCAG compliance, and I'd LOVE to see an API for this.

For example, a DIV with a click handler and simple text in it would be a perfect candidate for an accessibility violation. We can look at inline onClick handlers (and we plan to), but not the ones bound in memory. In JavaScript frameworks, many event bindings start their life inline in templates but are removed from the rendered HTML, so we can't sniff those out unless we can evaluate before the page is rendered–not a likely scenario for many accessibility testers.

There are a few potential false positives we've identified, such as a wrapper DIV with a click handler for a larger hit area but legitimately accessible UI controls inside (which is fine), and elements bound through event delegation on a parent element. But having an event detection API would be an excellent starting point.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/412#issuecomment-349158273

Received on Tuesday, 5 December 2017 00:52:08 UTC