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

Fix duplicate radio button hints #89

Merged

Conversation

stevehook
Copy link
Contributor

This is an attempt to fix a problem that was flagged in a usability/accessibility review of https://github.com/DFE-Digital/apply-for-postgraduate-teacher-training. We have a couple of places where we use govuk_radio_buttons_fieldset and govuk_radio_button with the hint_text option. The problem is that the hint span elements end up with the same id so they can't be linked to the correct radio button for accessibility purposes.

This seems to be because FieldsetRadioButton doesn't pass it's value to it's child Elements::Hint. Fix is simply to pass the value in the constructor.

We found that govuk_collection_radio_buttons already does this. It's not applicable in one of the cases for us because we use a divider within the radio button fieldset.

Unlike `govuk_collection_radio_buttons` this method does not pass the
value to the hint and therefore doesn't generate a unique id for each
hint element. Fix is simply to pass the value from FieldsetRadioButton
to Hint.
Copy link
Member

@peteryates peteryates left a comment

Choose a reason for hiding this comment

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

Spot on

@peteryates peteryates merged commit f50cc5a into x-govuk:master Jan 7, 2020
@peteryates peteryates added the bug Something isn't working label Jan 7, 2020
peteryates added a commit that referenced this pull request Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants