alphagov / govuk-design-system

One place for service teams to find styles, components and patterns for designing government services.
https://www.gov.uk/design-system
MIT License
492 stars 230 forks source link

Iterate accordion component #1379

Closed christopherthomasdesign closed 2 years ago

christopherthomasdesign commented 3 years ago

What

Iterate accordion component to be more accessible and consistent with how GOV.UK are doing step-by-steps.

We should also consider the details component which behaves in a very similar way.

The output of this stage of the work should probably be to have a prototype to test in user research.

Why

Who needs to know about this

Further detail

Done when

CharlotteDowns commented 3 years ago

The accordion component design has potential cross over with other components and patterns

Released

In the Community backlog

Other service components

christopherthomasdesign commented 3 years ago

Summary of chat with GOV.UK

Next steps:

christopherthomasdesign commented 3 years ago

Notes from accordion backlog discussion

CharlotteDowns commented 3 years ago

Examples of the accordion component across pages and services

christopherthomasdesign commented 3 years ago

Details and accordions

In theory, details and accordions are very similar – they both conceal additional content under a 'heading' that users can interact with to see more.

Just summarising some conversations we've recently had about each.

Question 1: could we use <details> for accordions?

We've discussed using the HTML details tag instead of the current button + JS approach for accordions.

On the face of it, it seems like a way to get native show & hide behaviour without using javascript. I guess the further implication might be that we could just have one component that replaces the 2 existing ones, covering the need to show & hide content.

TL;DR we probably shouldn't

There's a problem with using <details> for accordions - the <summary> part of <details>, which would contain the heading, treats elements inside it as having no semantics. So putting a section heading inside one would have no effect, it would be missed by screen readers etc.

And there are some problems with <details> generally:

Question 2: should details look more like accordions?

We know the details component has had some usability issues. Some users don't interact with them because they look like links and don't to leave the page they're on. We also know it is a matter of interpretation on whether the component passes WCAG SC 1.3.1 Info and relationships. Similarly, this is because it looks like a link but isn't one.

I think it's worth exploring how details could use similar design cues to those of accordions, given how similarly they behave.

References

christopherthomasdesign commented 3 years ago

Design update

We've been working with GOV.UK on iterating the visual design of the accordion to fix some accessibiltiy issues we've found.

For reasons outlined earlier in this issue, we're aiming for something that:

For context, here's the GOV.UK step-by-step as it currently works. The headings are buttons, and include some visually hidden spans so that screen readers read them as 'Do a thing, show this section'. The show/hide controls probably still look too much like links, albeit the words 'show' and 'hide' may suggest less that they might link to another page.

I've added a few screenshots below of us starting with the secondary button style and gradually developing them towards something that could work as accordions. There's also a big Figma file with many more design explorations.

Secondary buttons:

Screenshot 2020-10-21 at 16 06 46

Adding chevrons to give show/hide a bit more affordance:

Screenshot 2020-10-21 at 16 06 50

Making them white cos grey backgrounds not great for longer form text:

Screenshot 2020-10-21 at 16 06 55

How that might look as a step-by-step:

Screenshot 2020-10-21 at 16 07 00

Some ideas of how the states could work: Screenshot 2020-10-22 at 15 37 43

Next steps

I've created a first draft on this branch of Frontend. Have a look at a preview on my design system mess prototype (username:design password:mess). We'll be testing it in user research in the coming weeks... will add a summary of any findings here 👍

paulrobertlloyd commented 3 years ago

Very much like the direction this is headed – as well as the motivations behind it.

At first I wasn’t too sure about the disclosure icon being inside a circle. Circles are not something that appear too often on GOV.UK. That said, the crown logo features circles, and tittles and punctuation marks in Transport are circular too, so it doesn’t feel at odds with anything – in fact it offers some much needed visual contrast.

Will be interested to see where this heads!

frankieroberto commented 3 years ago

One downside of this design as it is might be that each section is a lot taller, at 116px vs 61px for the current design, which might make it harder to scan and compare, as you can see fewer sections at once.