-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
REDMOND\shwetasri
committed
Mar 12, 2024
1 parent
e5026ea
commit 76fb711
Showing
5 changed files
with
65 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Accessibility: Dropdown mising label or missing aria-labelledby (`@microsoft/fluentui-jsx-a11y/dropdown-needs-labelling-v9`) | ||
|
||
<!-- end auto-generated rule header --> | ||
|
||
Accessibility: Dropdown menu must have a visual label and it needs to be linked via htmlFor aria-labelledby of Label Or Dropdown mush have aria-label | ||
Dropdown having label linked via htmlFor in Label is recommended | ||
|
||
<https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA16> | ||
|
||
## Ways to fix | ||
|
||
- Add a label with htmlFor, add the id having same value as htmlFor to dropdown. | ||
- Add a label with id, add the aria-labelledby having same value as id to dropdown. | ||
- Add a aria-label to dropdown | ||
|
||
## Rule Details | ||
|
||
This rule aims to make dropdown accessible | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```jsx | ||
<Dropdown /> | ||
<Dropdown aria-labelledby="dropdown-id"></Dropdown> | ||
<> | ||
<Label /> | ||
<Dropdown aria-labelledby="dropdown-id"></Dropdown> | ||
</> | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```jsx | ||
<> | ||
<Label htmlFor="dropdown-id" /> | ||
<Dropdown id="dropdown-id"></Dropdown> | ||
</> | ||
<> | ||
<Label id="dropdown-id" /> | ||
<Dropdown aria-labelledby="dropdown-id"></Dropdown> | ||
</> | ||
<Dropdown aria-label="dropdown-label"></Dropdown> | ||
</> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters