Bug or potential issue - show-hide-content.js
See original GitHub issueHi,
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?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Yes. Imagine a situation where you have two sets of radios with the same
name
attributes. Outside of a form or within the same form they’ll share the selected state toggling behaviour. In two seperate forms they’ll maintain two seperate toggle states.Nice. +1