mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 01:04:00 -04:00
Add expanded semantics to radioSelect buttons
All buttons that open or close a region of the component should have aria-expanded attributes to show: - they have that control - the state of the region
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
{{/showNowAsDefault}}
|
{{/showNowAsDefault}}
|
||||||
<div class="radio-select__column">
|
<div class="radio-select__column">
|
||||||
{{#categories}}
|
{{#categories}}
|
||||||
<input type='button' class='govuk-button govuk-button--secondary radio-select__button--category' value='{{.}}' />
|
<input type='button' class='govuk-button govuk-button--secondary radio-select__button--category' aria-expanded="false" value='{{.}}' />
|
||||||
{{/categories}}
|
{{/categories}}
|
||||||
</div>
|
</div>
|
||||||
`),
|
`),
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<label for="{{id}}">{{label}}</label>
|
<label for="{{id}}">{{label}}</label>
|
||||||
</div>
|
</div>
|
||||||
{{/choices}}
|
{{/choices}}
|
||||||
<input type='button' class='govuk-button govuk-button--secondary radio-select__button--done' value='Done' />
|
<input type='button' class='govuk-button govuk-button--secondary radio-select__button--done' aria-expanded='true' value='Done' />
|
||||||
</div>
|
</div>
|
||||||
`),
|
`),
|
||||||
'chosen': Hogan.compile(`
|
'chosen': Hogan.compile(`
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
{{/choices}}
|
{{/choices}}
|
||||||
</div>
|
</div>
|
||||||
<div class="radio-select__column">
|
<div class="radio-select__column">
|
||||||
<input type='button' class='govuk-button govuk-button--secondary radio-select__button--reset' value='Choose a different time' />
|
<input type='button' class='govuk-button govuk-button--secondary radio-select__button--reset' aria-expanded='false' value='Choose a different time' />
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -179,6 +179,14 @@ describe('RadioSelect', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("each button's semantics should show it controls another region and that region is collapsed", () => {
|
||||||
|
|
||||||
|
categoryButtons.forEach(btn => {
|
||||||
|
expect(btn.getAttribute('aria-expanded')).toEqual('false');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -241,6 +249,7 @@ describe('RadioSelect', () => {
|
|||||||
|
|
||||||
expect(button).not.toBeNull();
|
expect(button).not.toBeNull();
|
||||||
expect(button.getAttribute('value')).toEqual('Done');
|
expect(button.getAttribute('value')).toEqual('Done');
|
||||||
|
expect(button.getAttribute('aria-expanded')).toEqual('true');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user