When to use a button and a link

For most document type websites the question between links and buttons doesn't really exist. But in application type websites, it's often that developers don't pick the right one or that designers make links look like buttons.

So to make it clear:

This difference of behavior is super important, especially in single page JavaScript web applications where urls are changed dynamically, but no page change is triggered in the browser! When such a thing happens, the developer has to manually move the focus of the screen reader user to the next point of interest inside the app and vocalize what happened and where the user is.

To do this, the developer has to use the .focus() function in JavaScript. I'm not 100% sure about how to vocalize the page change so I'm not gonna give any advice on this. If you know good practices please contact me so I can update this part.

One last thing: I don't care about your reasons, don't replace a <button> by a <div>.

Next: The mess of strong b em and i

Initially published: November 23rd, 2020
Generated: November 12th, 2021