web-accessibility
web-accessibility copied to clipboard
[div onclick="doStuff()"] should trigger an error
Is your feature request related to a problem? Please describe.
Dev's will commonly use <div> elements for buttons when they should be using <button> elements instead.
Describe the solution you'd like
<div onclick="doStuff()"> should trigger an error different to the typical "Use Semantic HTML5 or specify a WAI-ARIA role [role=""]" warning.
It should say something like "Use a <button> element instead of a <div> element for interactive controls."
He @Dan503 I think that's a good addition to the check, will look in to it!
There are legitimate cases for adding div[onclick] so there should also be a way to ignore this rule.
(eg. Making a card clickable without wrapping the whole card in a link while making the heading inside the card an <a> element)