alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.16k stars 320 forks source link

conditional reveals don't work with HTML #953

Closed zacmarshall closed 6 years ago

zacmarshall commented 6 years ago

We are using the HTML versions of the new GDS standards and have found that the code for conditionally revealing content doesn't work.

Please see attached example, changing to use the JavaScript supplied for the Node version or the JS used on the demo page works OK.

I have attached html, css and js based on the page at https://design-system.service.gov.uk/components/radios/conditional-reveal/index.html

Swapping the JS to use the commented line will result in the conditional reveal working.

  <script src="./javascripts/govuk-frontend-1.2.0.min.js"></script>
zacmarshall commented 6 years ago

Network seems to prevent file being attached, please email and I will provide.

36degrees commented 6 years ago

Hi Zac,

I don't believe you're able to attach files to GitHub issues – can you email govuk-design-system-support@digital.cabinet-office.gov.uk and we can investigate.

Thanks,

Ollie

zacmarshall commented 6 years ago

Just emailed the html, earlier zip file with JS got bounced.

Zac

36degrees commented 6 years ago

Hi Zac,

It looks like you're not initialising the components – at least not that I can see from the index.htm file you sent over, but it's hard to tell without the context of the other files you're including.

You can initialise all Frontend components on the page by calling <script>window.GOVUKFrontend.initAll()</script> before your closing </body> tag, as documented in the 'installing from dist' instructions.

Thanks,

Ollie

36degrees commented 6 years ago

Hi Zac,

I'm going to close this now as I believe we've resolved your problem. If you're still having issues, please feel free to re-open this.

Ollie