DEV Community

Discussion on: Dear Web Devs, Please Use Anchors Instead of Divs for Buttons

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

If a site or web app is well made - it should already be possible to navigate with the keyboard - without an extension. The fact that you even need one is a sad indictment of the state of modern web development.

In general, buttons that just do something on the page should probably be <button> or <input type="button/submit/etc.">. If they actually 'take' you somewhere - like another page or part of the app, they should be anchor tags (possibly styled to look like a button if the design requires it) - this way, all normal stuff like opening a link in a new tab works as expected.

I've seen at least 5 documentation sites for APIs recently where every single 'link' on the page is JS framework 'powered' - obliterating any hope of easily copying link URLs, opening doc links in new tabs etc. Seriously, WTF?

Sadly, in recent times - a lot of developers don't seem to to care about this kind of stuff whatsoever... and websites/apps have gotten crappier and crappier with respect to basic expected navigation features.

Collapse
 
cppshane profile image
Shane Duffy • Edited

Yeah Vimium supports <button> as well. But you're right, web devs just don't care about this stuff. They seem to be more concerned with fancy animations and such.

And I didn't even think about the accessibility aspect of it, as mentioned by @andrewbaisden. I just prefer pure keyboard access for ease of use, but it's probably a necessity for a lot of people with disabilities.

smh web devs

Collapse
 
blindfish3 profile image
Ben Calder

I think it's less the case that developers don't care, and more the case that they're simply unaware of the problem. Modern frameworks make it far too easy to create inaccessible content and it seems there just isn't enough awareness of these issues.
It also points to poor QA processes. I usually pick this up in code review, and it definitely shouldn't get past a QA tester.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

The fact that they're unaware of the problem is a problem in itself