hmrc / component-library-template

Template files for HMRC's component library
1 stars 16 forks source link

Display components in their no-JS state #21

Open rpowis opened 8 years ago

rpowis commented 8 years ago

We have a few components that could benefit from having their no-JS versions displayed easily.

I propose adding a "toggle JS" button/link that:

Open to other ideas of course

feedmypixel commented 8 years ago

the component library already has js and js-enabled as per https://github.com/hmrc/component-library-template/blob/master/index.html#L230 (due to differeing js and js-enabled classes being used between assets-frontend and govuk_template work)

The display: block for this component is controlled via a specific selector .js .email-form-errors .error-notification in _unknown.scss

and the JavaScript saEmailPrefs.js adds the selector form-field--error in errors.scs which then displays the error.

So its a little trickier than above.

I have raised the issue https://github.com/hmrc/assets-frontend/issues/640 around this to clear up all the form validation work.

Due to things working in different ways it would probaly be better to not document this in the component library as you touched on here https://github.com/hmrc/assets-frontend/pull/639#issuecomment-225657706