Skip to content

Commit

Permalink
Test alt to toggling a11y attributes of conditional
Browse files Browse the repository at this point in the history
To fix "Elements must only use allowed ARIA attributes"
#979

Attempted solution:
- Remove aria-expanded
- Follow "Optionally, each element that serves as a container for
panel content has role region and aria-labelledby with a value that
refers to the button that controls display of the panel" from
https://www.w3.org/TR/wai-aria-practices/#accordion
  • Loading branch information
hannalaakso committed Aug 27, 2019
1 parent 5a514ce commit fc3c04a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/govuk/components/radios/radios.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Radios.prototype.setAttributes = function ($input) {
if ($content && $content.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked

$input.setAttribute('aria-expanded', inputIsChecked)

$content.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/govuk/components/radios/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
{% endif %}
</div>
{% if item.conditional %}
<div class="govuk-radios__conditional{% if not item.checked %} govuk-radios__conditional--hidden{% endif %}" id="{{ conditionalId }}">
<div class="govuk-radios__conditional{% if not item.checked %} govuk-radios__conditional--hidden{% endif %}" id="{{ conditionalId }}"
aria-labelledby="{{ id }}" role="region">
{{ item.conditional.html | safe }}
</div>
{% endif %}
Expand Down

0 comments on commit fc3c04a

Please sign in to comment.