Closed christopherthomasdesign closed 2 years ago
Next steps:
People put all sorts of things in accordions – lists of checkboxes, dashboard-like displays of data, big lists of links etc. Sometimes it's hard to see where one section ends and another begins.
Lots of evidence that users can miss the right-aligned +/− controls, and that moving them to the left and adding a word like 'show/hide' helps
Some support for using the words 'show/hide' on the controls rather than 'open/close' as it's more generic and is maybe a less visual interpretation of what an accordion is doing
Frankie Roberto helpfully describes the different use cases of details and accordions:
Nielsen Norman did a study that found that 'caret' icons (i.e. downward-facing arrows) matched users' expectations most closely, compared to plus icons, no icon, sideways arrows etc.
There was one example shared of a nested accordion, though I'm not sure this is a common or desirable use of 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.
<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.
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:
<details>
so they don't offer a 'script-free' way of doing exandable things – you need a polyfillWe 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.
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:
Adding chevrons to give show/hide a bit more affordance:
Making them white cos grey backgrounds not great for longer form text:
How that might look as a step-by-step:
Some ideas of how the states could work:
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 👍
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!
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.
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