Skip to content

Commit

Permalink
fix: Use aria-checked for AssignTesterDropdown (#1097)
Browse files Browse the repository at this point in the history
Address #977 

* Use aria-checked for `AssignTesterDropdown`
* Update dropdown item role to `menuitemcheckbox` and remove `aria-hidden` from username
  • Loading branch information
evmiguel committed May 20, 2024
1 parent 9414180 commit ae97530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 5 additions & 10 deletions client/components/TestQueue/AssignTesterDropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ const AssignTesterDropdown = ({
}
return (
<Dropdown.Item
role="menuitem"
role="menuitemcheckbox"
variant="secondary"
as="button"
key={`tpr-${testPlanReportId}-assign-tester-${username}`}
aria-checked={
testerIsAssigned ? true : false
}
onClick={async () => {
const updatedIsAssigned =
!testerIsAssigned;
Expand All @@ -189,15 +192,7 @@ const AssignTesterDropdown = ({
}}
>
{icon && <FontAwesomeIcon icon={icon} />}
<span className="sr-only">{`${username} ${
testerIsAssigned
? 'checked'
: 'unchecked'
}`}</span>
<span
aria-hidden="true"
className={classname}
>
<span className={classname}>
{`${tester.username}`}
</span>
</Dropdown.Item>
Expand Down
4 changes: 2 additions & 2 deletions client/tests/AssignTesterDropdown.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('AssignTesterDropdown', () => {
fireEvent.click(button);

const items = await screen.findAllByText(/bee/);
expect(items.length).toBe(2); // One for display, one for sr-only
expect(items.length).toBe(1);
fireEvent.click(items[0]);

await waitFor(async () => {
Expand All @@ -205,7 +205,7 @@ describe('AssignTesterDropdown', () => {
fireEvent.click(button);

const items = await screen.findAllByText(/NVDA Bot/);
expect(items.length).toBe(2); // One for display, one for sr-only
expect(items.length).toBe(1);
fireEvent.click(items[0]);

await waitFor(() => {
Expand Down

0 comments on commit ae97530

Please sign in to comment.