hmrc/assets-frontend

toggle class doesn't work when javascript is turned off

Closed this issue · 2 comments

the toggle module (https://github.com/hmrc/assets-frontend/blob/master/assets/javascripts/modules/toggle.js) uses a hard coded 'hidden' class.

uses with javascript disabled wont be able to see the content.

In the example, the element that toggles is nested inside an element with the class visible-javascript-on, so this element is only visible when JavaScript is on. The original use case was to have a totally different element visible when JavaScript is Off and the one with the toggle functionality hidden.

If you wish to use it as a standalone js-toggle you can replace hidden with js-hidden on the target elements.

It feels like this information should also be added to the description as a separate example

We will address this issue if we come across it again in the new AF 4