All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Why Using Div Elements Instead of Buttons Harms Web Accessibility

By

moebrowne

7mo ago· 4 min readenOpinion

Summary

The article argues against using div elements as substitutes for button elements in web development, particularly criticizing developers who use onclick handlers on divs instead of proper button elements. The author explains that divs lack proper accessibility features: they don't announce themselves as interactive elements to screen readers, can't be focused with a keyboard, and don't respond to Enter or Space Bar key presses. The piece targets framework-enthusiastic developers in React and HTMX communities who prioritize convenience over accessibility standards.

Key quotes

· 4 pulled
One of the weirdest 'debates' I seem to perpetually have with framework-enthusiastic developers is whether or not a <div> is 'just as good' as a <button>
This element does not announce itself as an interactive element to screen reader users
You can't focus on a <div> with a keyboard
The event only fires on click, not when the Enter or Space Bar keys are pressed (again, keyboard users)
Snippet from the RSS feed

You might also wanna read