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

Clarify docs for radio and checkbox conditionals #3552

Merged
merged 1 commit into from
Apr 26, 2023
Merged

Conversation

36degrees
Copy link
Contributor

The documentation for the conditional Nunjucks macro option for checkboxes and radios is confusing.

The checkboxes documentation lists conditional as a boolean, and the radios documentation lists it as a string.

Neither are correct.

The conditional option is an object with a single nested option, html. The nested html option is a string, used to specify the content that is revealed when the checkbox or radio is checked.

Update the component YAML so that the documentation reflects this.

Checkboxes

Before

Screenshot 2023-04-26 at 09 34 30

After

Screenshot 2023-04-26 at 09 47 31
Screenshot 2023-04-26 at 09 47 38

Radios

Before

Screenshot 2023-04-26 at 09 35 20

After

Screenshot 2023-04-26 at 09 48 05
Screenshot 2023-04-26 at 09 48 12

Closes #1903

The documentation for the conditional Nunjucks macro option for checkboxes and radios is confusing.

The checkboxes documentation lists `conditional` as a boolean, and the radios documentation lists it as a string.

Neither are correct.

The `conditional` option is an object with a single nested option, `html`. The nested `html` option is a string, used to specify the content that is revealed when the checkbox or radio is checked.

Update the component YAML so that the documentation reflects this.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3552 April 26, 2023 08:54 Inactive
@colinrotherham
Copy link
Contributor

colinrotherham commented Apr 26, 2023

Thanks @36degrees

You probably know I've written types for the YAML component data here:
https://github.com/alphagov/govuk-frontend/blob/main/shared/lib/files.js#L163

This is so we can get autocomplete (and checks) in tests using getExamples() etc

But the example data just has a generic {object} type so getComponentData() isn't that helpful, but if we're bringing things in line it might be good to start typing it with the various flavours of component data

Might reveal other places where we've got the object structure wrong

Copy link
Member

@querkmachine querkmachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs changes look good to me :shipit:

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

Successfully merging this pull request may close these issues.

Confused by the documentation for radios 'conditional'
4 participants