Button vs Link vs Div Playground

A bench of real elements: Tab, Enter, Space, middle-click. See for yourself which is a button, which is a link, which is just a box. An interactive Button vs…

Why it matters

<button> and <a href> come with focus, Enter and Space, a role for screen readers, middle-click, "Open in new tab" and the Back button. <div onclick> gets none of it. Keyboard users, screen reader users and people who open lots of tabs are real users, and the wrong element locks them out.

The key idea

One question: go to an address, or change state?

Common mistakes

Try it in this playground