Clickable divs (use a button) — why this matters

A small UI accessibility note, with an interactive BEFORE/AFTER demo.

A common UI bug: something looks like a button, but it’s implemented as a plain <div> with a click handler.

That can break keyboard access: a plain <div> is not focusable by default, so a keyboard user can’t reach it with Tab. (It’s also missing built-in semantics that assistive tech expects.)

The fix: use a real <button> (or <a>)

Native controls come with keyboard behavior for free: Tab focus, Enter/Space activation, and default semantics.

If you absolutely must use a non-native element, you need to add focusability and keyboard handling (e.g., tabindex="0" and Enter/Space handlers), but in most cases the simplest and most reliable fix is: use a real button.

Notes

Related: focus ring demo · toggle button demo