-
Notifications
You must be signed in to change notification settings - Fork 327
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
Make it easier to add a hint or an error message to a fieldset #1166
Comments
@36degrees After exploring the code a bit more, it might be worth creating a macro for:
Where This way we can automatically output the mandatory Removes a lot of duplication between all the macros. The problem with only extending |
I came across this today. We are adding a line of text to a page which collects someone’s address, in order to explain what the address will be used for (in this case, to send them post). I expected the Screenshot |
What
If you want to use the fieldset component to group related fields, for example asking for a street address, you need to take care of including the hint / error message components separately and do extra work to associate them with the fieldset.
We do not provide any examples or guidance on how to do this, and it would be easy to get wrong (for example, by not creating the association with the fieldset)
It therefore seems like it would be useful if the fieldset component accepted
hint
anderrorMessage
objects and took care of this association itself.Why
This was requested by @edwardhorsford in alphagov/govuk-design-system#778 (comment).
Additional information
The radios, checkbox and date input components all use hints and error messages which are then associated with the fieldset using
aria-describedby
. However, this logic is handled (and therefore duplicated) within the individual components.Moving this logic to the fieldset component might allow us to simplify the repeated logic in the radios, checkboxes and date input components. However, it's not clear what should happen to the hint / error message if you do not include a fieldset.
The text was updated successfully, but these errors were encountered: