Open rpowis opened 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
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:
$(document.body).toggleClass('js js-enabled')
as a starting point.data-*
attributes and/or JS classes on the component tooOpen to other ideas of course