Checkboxes have a conditional reveal option that uses the value of the aria-controls attribute on the checkbox to apply a class of govuk-checkboxes__conditional--hidden to the content being shown or hidden, depending on the checked state of the checkbox.
In GOV.UK we're using the aria-controls attribute on finders to refer to a part of the page that shows the number of search results. This is so users of assistive tech have some association between their change (checking the checkbox) and the page updating dynamically. The checkboxes Javascript isn't limited to the scope of the component, so when we use it like this it's appling the conditional class to hide the element, which is not desirable.
Here it is in action:
The 'show only brexit results' checkbox has aria-controls pointing to the '5 results' part of the page.
Just after we've checked the checkbox, the results count and associated tags disappears:
The fix might be to check to see if the element referred to by aria-controls is within the component before applying the class.
I need a fix for this fairly quickly so I'll write some temporary CSS to override the class being added by the checkbox JS, but will happily delete that once a solution is found.
Checkboxes have a conditional reveal option that uses the value of the
aria-controls
attribute on the checkbox to apply a class ofgovuk-checkboxes__conditional--hidden
to the content being shown or hidden, depending on the checked state of the checkbox.In GOV.UK we're using the
aria-controls
attribute on finders to refer to a part of the page that shows the number of search results. This is so users of assistive tech have some association between their change (checking the checkbox) and the page updating dynamically. The checkboxes Javascript isn't limited to the scope of the component, so when we use it like this it's appling the conditional class to hide the element, which is not desirable.Here it is in action:
The 'show only brexit results' checkbox has
aria-controls
pointing to the '5 results' part of the page.Just after we've checked the checkbox, the results count and associated tags disappears:
The fix might be to check to see if the element referred to by
aria-controls
is within the component before applying the class.The JS is here: https://github.com/alphagov/govuk-frontend/blob/master/src/components/checkboxes/checkboxes.js#L39
I need a fix for this fairly quickly so I'll write some temporary CSS to override the class being added by the checkbox JS, but will happily delete that once a solution is found.
Thanks!