Keyboard button clicks with Space and Enter behave differently
- Published at
- Updated at
- Reading time
button, you should hold on and ask yourself if you're using the correct element. Semantic HTML provides additional functionality to assistive technology and is usually more accessible than clickable div soup.
For example, buttons come with keyboard accessibility features built-in. They're focusable and can be clicked by pressing
But did you know that the two keys click buttons differently?
Enterclicks a focused button on
Spaceclicks a focused button on
I found this little fun fact on Adrian's blog. Check out the post to learn more and see this click behavior in action.