dequelabs / axe-core

Accessibility engine for automated Web UI testing
https://www.deque.com/axe/
Mozilla Public License 2.0
5.75k stars 746 forks source link

Is there a way to detect non-accessible interactive elements on a webpage? #4487

Closed kozack-webspark closed 3 weeks ago

kozack-webspark commented 3 weeks ago

Product

axe-core

Question

Let's say I have a webpage with <div> on it. This element doesn't have any role or tabindex. But JavaScript on this page create a click event listener on this element. Obviously this is a critical issue but seems, axe doesn't detect it. I just try to run analyze (i use play write integration) with non-accessible div and axe ignore this issue.

Is there a way to detect such cases?

straker commented 3 weeks ago

Thanks for the question. Unfortunately JavaScript has no way to detect event listeners on elements so it's not possible to detect interactive elements that only use event listeners. Chrome supports getEventListeners, but it's only available in the DevTools console.