Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Using a div instead of a button is just dumb.

However, I was tweaking my app today, after having read this article, and realized I'm using some anchor-links as buttons just because I wanted them to be styled exactly like a link.

Then I tried adding role="button" and of course I couldn't tab over to my link-button. So I added tabindex="0", just like the article tells you not to do, and that allowed me to tab over to it but I still couldn't activate it with spacebar.

So I finally caved and Googled "how do I make a button look just like a link" which brought me to this article: https://piccalil.li/blog/link-button/

And now it behaves properly. Yay a11y.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: