-
Notifications
You must be signed in to change notification settings - Fork 107
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
Bug or potential issue - show-hide-content.js #366
Comments
@gemmaleigh bumped into this when adding radio buttons to GOV.UK Frontend – the selection button JS assumes a form as well. In that case we decided that we can drop the JS entirely given a change in markup, but here we probably just need a check for the existence of a form ancestor. Something like this might work?
|
@robinwhittleton That looks fine to me. What's the reason for using closest? To restrict the affected radios to just those within the form that they are situated? |
Yes. Imagine a situation where you have two sets of radios with the same |
I thought so but my brain was failing me. :) 👍 |
Nice. +1 |
Hi,
Following up from a discussion with @dsingleton on XGOV Slack. I noticed a slight issue with the
show-hide-content.js
code.If you examine line 83 you will see there is an assumption that the 'Conditionally revealing content' pattern will existing within a
form
element.As I was quickly hacking together a prototype within the the govuk prototyping kit, I hadn't wrapped the markup in a form element and it broke silently (no errors or console warnings). It's an edge case but as there is now a firm movement toward modular builds of components this could bite people.
Simple short term suggestion, check for existence of a form element, else console log a developer friendly message.
Longer term, assume this will be replaced by what's delivered in GOVUK Front-end?
The text was updated successfully, but these errors were encountered: