-
Notifications
You must be signed in to change notification settings - Fork 21
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
Propagate value to hint element in FieldsetCheckBox #211
Propagate value to hint element in FieldsetCheckBox #211
Conversation
The value was missing from the `hint_options` hash, and the consequence was (because a `nil` value) the fallback to the hint text of the fieldset, when declaring individual checkboxes inside a `govuk_check_boxes_fieldset` (for example if one of the check boxes has to reveal a text area) The code causing the issue was (it was entering in the second branching due to value being `nil`): ```ruby def schema_path if @value.present? [@object_name, "#{@attribute_name}_options", @value] else [@object_name, @attribute_name] end end ```
Great, thanks for this. I definitely think a spec or two to cover this is a good idea. |
@peteryates I tried to add an example to the guide, but for some reason couldn't get it to work this time. I've upgraded my system recently so I think some dependency is now broken, I got this:
We have smoke tests with markup fixtures that raised this issue when trying to use the latest version of the gem (in one of our projects we were still in the 1.2.x branch) 👍 |
Ah. your Ruby is probably compiled against the older library. I expect reinstalling Ruby |
There was already an example but the existing one was simpler, using the `govuk_collection_check_boxes`. This new example focus more in the `govuk_check_boxes_fieldset` declaring individual check boxes and one with a revealing text box. Each of the check boxes have independent labels and hints localised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant, thank you 🧟♂️
A new version of the gem that introduces the fix for the check boxes hint has been released and we can start using it. https://github.com/DFE-Digital/govuk_design_system_formbuilder/releases/tag/v2.1.2 PR with the fix and more details: x-govuk/govuk-form-builder#211
@peteryates I believe there is a similar issue with |
The value was missing from the
hint_options
hash, and the consequence was (because anil
value) the fallback to the hint text of the fieldset, when declaring individual checkboxes inside agovuk_check_boxes_fieldset
(for example if one of the check boxes has to reveal a text area)The code causing the issue was (it was entering in the second branching due to value being
nil
):Example before
Example after
If any of the individual check boxes had a hint text declared in the locales, it will show as expected: