Fix duplicate IDs on course site page #1021
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HAVE RAISED AN ALTERNATIVE PR TO FIX THIS IN THE FORM BUILDER https://github.com/DFE-Digital/govuk_design_system_formbuilder. IF THAT GETS MERGED I CAN JUST CLOSE THIS PR.
Context
The hint
span
element rendered on the candidate course site selection page are duplicates because they don't include anything unique to the individual radio buttons to which they relate. This was flagged as an issue in the DAC report.Changes proposed in this pull request
govuk_radio_buttons_fieldset
forgovuk_collection_radio_buttons
which seems to handle hint ids correctly (it includes the value of the radio button in the hint id).After a bit of debugging it seems
govuk_radio_buttons_fieldset
allows you to create a hint for each radio button but it doesn't give you any control over the id of the hint element. This depends only on the name of the field not the value of the individual buttons because, for some reason,FieldsetRadioButton
just doesn't pass the value to the hint element.CollectionRadioButton
does pass the value and it appears to do everything else that we need though the markup varies (see below).The only visible difference (that I can see) is that the radio button labels are now bold. There is actually an option to to make them bold, they are normally not bold by default but if you include a
hint_method
as we must do here that option is ignored and they are always bold (to make them stand out from the hint according to the docs). I guess we would need some CSS to keep the non-bold labels if that's important.Before:
After:
Guidance to review
govuk_radio_buttons_fieldset
forgovuk_collection_radio_buttons
?Link to Trello card
https://trello.com/c/LqbMmzbb/692-dac-page-13-fix-duplicate-ids-on-course-site-page
Things to check