Custom checkboxes done right |

Custom checkboxes done right

Posted Feb 17, 2020


When creating a web page, it’s generally advisable to use native HTML elements as much as possible. You get all of the accessibility semantics and keyboard interactions for free, out of the box. In fact, this is such good advice that the W3C went to the point of making a rule about it:

…or more accurately:

If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, then do so.W3C, Using ARIA

In short, instead of using a <div> and plastering it with extra ARIA and Javascript to make it accessible, it’s better to just use a <button> element. It’s a lot less work and a lot more reliable.

But while this is certainly sound advice, and better for [...]

Read article at

Article Taxonomies

Categories: Terms: , , ,