DOI-ONRR / onrr.gov-site

We will use this repo to manage our work on the onrr.gov website
11 stars 3 forks source link

Change buttons to links when appropriate #3186

Open eelzi-ONRR opened 3 months ago

eelzi-ONRR commented 3 months ago

Best practice is to only use buttons to complete an action, not to simply link to another site or page. Many of our buttons on onrr.gov should just be links - we use action words on these buttons but they are still just links.

Homepage: Revenue Data button in the top right, View All buttons for reporter letters and press releases.

We can stylize the links to draw attention to them - especially the view all links. Maybe we can add additional style options to the new link editor to do so - such as font size?

AlexandracmONRR commented 1 month ago

We need more clarification on this. @lpgoldstein

AlexandracmONRR commented 1 month ago

From Accessibility in Design course

How does using the wrong element negatively affect accessibility?

I’ll answer this with a little story someone told me: a person, who uses a screen reader, calls the help desk with an issue. The tech support rep begins walking them through how to troubleshoot the issue. The rep tells them “click the button...”. And visually it does look like a button, but it’s coded as a link. Because, programmatically, it was most appropriate for it to be a link. But the designer designed it to look like a button for stylistic reasons. Now the screen reader user is going through the elements on the page listening for the “button” element, but they can’t find it, and won’t find it, because it’s going to be announced as a link.

This is one example of how accessibility is negatively affected when buttons and links are not appropriately designed and coded to be consistent.

One more thing that’s helpful to know is that: Keyboard users select a button with the Space bar or the Enter key, but they select a link with just the Enter key (the Space bar does not work to select links). So if they see a button on the page and hit Spacebar to select it, but programmatically it's a link, the spacebar will not select it. If it looks like a button and is programmatically a button, then the spacebar will work.

When When to use a link and when to use a borderless button (or a button in general)?

Use a link when...

Use a button when...

lpgoldstein commented 1 month ago

This should be a link: image.png

lpgoldstein commented 1 month ago

These should be links: image.png

lpgoldstein commented 1 month ago

More button notes: For a quick review:

Links take users to a new page or location when activated. Buttons trigger an action, such as submitting a form or opening hidden content. In this case, a "Sign In" component functions as both a link and a button since it has both actions. It is recommended to code "Sign In" or "Log In" components as buttons since they submit information and perform an action

cthomasONRR commented 1 month ago

@greensomes We need your help to change the NRRD header button to just a link and for the "view all" links within collections.

I can go in and fix the other NRRD link today.

cthomasONRR commented 1 month ago

Removed buttons and replaced as links for:

All updates are noted in the content audit.

Need Jeff's help to remove buttons for:

Only buttons that should be left alone are for:

cthomasONRR commented 1 month ago

Putting this back in the backlog for when Jeff has time. Everything that doesn't require Jeff's help is complete.