Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document / Implement Radio 'selected' value #1422

Closed
andrewcharnley opened this issue Dec 9, 2020 · 5 comments
Closed

Document / Implement Radio 'selected' value #1422

andrewcharnley opened this issue Dec 9, 2020 · 5 comments

Comments

@andrewcharnley
Copy link

Re: https://design-system.service.gov.uk/components/radios/

There's nothing here about pre-selecting a radio button on the above.

I attempted to use selected:true on one of the items as is the logic for the select component but this hasn't worked.

@frankieroberto
Copy link
Contributor

frankieroberto commented Dec 9, 2020

@andrewcharnley Hi Andrew. If you pass in checked: true for the item it should work. I make this mistake all the time! I think the param name is checked rather than selected is because in the HTML the attribute is called checked for both radio inputs as well as checkboxes. No idea why - I suspect it goes back to the early days of HTML!

Incidentally, if you're wanting to check which options the Nunjucks macro supports, there's a "Nunjucks macro options" details link within the Nunjucks tabs on the Design System website, which reveals a table describing them all. (I often forget this too, as it's slightly hidden)

Screenshot 2020-12-09 at 15 10 30

@andrewcharnley
Copy link
Author

andrewcharnley commented Dec 9, 2020

Checked... yes I should have checked that. :)

Missed that link entirely. It would be good to add checked=true into the documentation example item[0], no harm and I assume most will need it.

Thanks!

@36degrees
Copy link
Contributor

Thanks @frankieroberto!

It would be good to add checked=true into the documentation example item[0], no harm and I assume most will need it.

We wouldn't do this for the default example as it contradicts our guidance which says:

Do not pre-select radio options as this makes it more likely that users will:

  • not realise they’ve missed a question
  • submit the wrong answer

I can see how it'd be useful to show how to select a radio that the user previously chose (for example if returning to the page later, or if displaying an error summary) but if we were going to do that I think we'd need to describe this in the guidance and provide a separate example.

@36degrees 36degrees transferred this issue from alphagov/govuk-design-system-backlog Dec 9, 2020
@36degrees 36degrees added the awaiting triage Needs triaging by team label Dec 9, 2020
@andrewcharnley
Copy link
Author

I'm doing both, the first is the wish of the UX, who I'll happily wind up tomorrow morning with that paragraph.

Thanks for the prompt reply all!

@hannalaakso
Copy link
Member

@andrewcharnley I've linked to your comment about missing the link for the Nunjucks options table as it's useful for us to know when we consider how to improve the presentation of this content to users. If you feel that I've misrepresented your comment in any way or you'd like to add anything else feel free to comment on that card.

As your issue was resolved I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants