alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.18k stars 325 forks source link

Summary list - Can we avoid using a list for a single action? #1128

Closed joelanman closed 5 years ago

joelanman commented 5 years ago

The primary use case for summary list is Check Answers, which has one action - 'Change'

In the markup, this is wrapped in a list (ul, li), to allow for multiple actions. However in the case of one action, this is arguably not semantically correct, and makes the markup more complicated than it needs to be.

Can we avoid a list when there's only one action?

NickColley commented 5 years ago

As I mentioned in the thread (https://github.com/alphagov/govuk-design-system-backlog/issues/182#issuecomment-453187133), we decided to do this so that you could compare lists with a single item on one row with another row, which may have multiple actions.

Semantically it is correct, and tested well in assistive technologies.

https://www.w3.org/TR/html52/grouping-content.html#the-ul-element

Zero or more li and script-supporting elements.

The point about there only being one action most of the time seems fair given that this component is featured in the check your answers pattern so this seems worth doing.