mvdschee / web-accessibility

A Visual Studio Extension for Web accessibility
https://marketplace.visualstudio.com/items?itemName=MaxvanderSchee.web-accessibility
MIT License
70 stars 13 forks source link

[div onclick="doStuff()"] should trigger an error #38

Open Dan503 opened 4 years ago

Dan503 commented 4 years ago

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."

mvdschee commented 4 years ago

He @Dan503 I think that's a good addition to the check, will look in to it!

Dan503 commented 4 years ago

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)