Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove aria-expanded from radios with conditional content when JS is enabled #2823

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package/govuk-esm/components/radios/radios.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
if ($target && $target.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked

$input.setAttribute('aria-expanded', inputIsChecked)
$target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked)
}
}
Expand Down
1 change: 0 additions & 1 deletion package/govuk/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,6 @@ Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
if ($target && $target.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked;

$input.setAttribute('aria-expanded', inputIsChecked);
$target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);
}
};
Expand Down
1 change: 0 additions & 1 deletion package/govuk/components/radios/radios.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,6 @@ Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
if ($target && $target.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked;

$input.setAttribute('aria-expanded', inputIsChecked);
$target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);
}
};
Expand Down
1 change: 0 additions & 1 deletion src/govuk/components/radios/radios.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
if ($target && $target.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked

$input.setAttribute('aria-expanded', inputIsChecked)
$target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked)
}
}
Expand Down
14 changes: 0 additions & 14 deletions src/govuk/components/radios/radios.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ describe('Radios with conditional reveals', () => {
const $ = await goToAndGetComponent('radios', 'with-conditional-items')
const $component = $('.govuk-radios')

const hasAriaExpanded = $component.find('.govuk-radios__input[aria-expanded]').length
const hasAriaControls = $component.find('.govuk-radios__input[aria-controls]').length

expect(hasAriaExpanded).toBeFalsy()
expect(hasAriaControls).toBeFalsy()
})

Expand Down Expand Up @@ -78,18 +76,6 @@ describe('Radios with conditional reveals', () => {
expect(isContentHidden).toBeTruthy()
})

it('indicates when conditional content is collapsed or revealed', async () => {
await goToAndGetComponent('radios', 'with-conditional-items')

const isNotExpanded = await waitForVisibleSelector('.govuk-radios__item:first-child .govuk-radios__input[aria-expanded=false]')
expect(isNotExpanded).toBeTruthy()

await page.click('.govuk-radios__item:first-child .govuk-radios__input')

const isExpanded = await waitForVisibleSelector('.govuk-radios__item:first-child .govuk-radios__input[aria-expanded=true]')
expect(isExpanded).toBeTruthy()
})

it('toggles the conditional content when clicking an input', async () => {
const $ = await goToAndGetComponent('radios', 'with-conditional-items')
const $component = $('.govuk-radios')
Expand Down