TLDR Web Dev · ARTICLES & TUTORIALS

THE GIFT YOU DO NOT WANT: A DIV IN A BUTTON'S CLOTHING

htmhell.dev10 min read

Summary from the TLDR Web Dev newsletter

Semantic HTML can be important for accessibility, as shown by the difference between using a `button` element versus a `div` styled as a button. By comparing the accessibility tree representations and keyboard behavior of both genuine and fake buttons, this article shows how using a `div` requires extra code to achieve proper accessibility, whereas a `button` inherently provides the necessary features.