-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STCOM-977 Aria-labeling MultiSelection (#1868)
* Storybook for multi-select with no aria label * add ariaLabel prop and functionality * add axe test to multiselection ariaLabel * add aria-label test * lint * tweak the comment * include storybook dep to silence lint * additional story lint * Update CHANGELOG.md Co-authored-by: Ryan Berger <[email protected]>
- Loading branch information
1 parent
15b5f7f
commit 5fcea71
Showing
6 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useState } from 'react'; | ||
import MultiSelection from '../MultiSelection'; | ||
import Headline from '../../Headline'; | ||
|
||
const optionList = [ | ||
{ value: 'test0', label: 'Option 0' }, | ||
{ value: 'test1', label: 'Option 1' }, | ||
{ value: 'test2', label: 'Option 2' }, | ||
]; | ||
|
||
const HiddenLabel = () => { | ||
const [values, setValues] = useState([]); | ||
|
||
return ( | ||
<div> | ||
<Headline size="large"> | ||
Multiselect with no visible label | ||
</Headline> | ||
<p> | ||
The "ariaLabel" prop is used to apply a label that | ||
is not visible to the user, but accessible to screenreaders. | ||
This is preferable for "required" fields over | ||
"ariaLabelledby" since the labeling elements will | ||
not need to display an asterisk. | ||
</p> | ||
<MultiSelection | ||
id="my-multiselect" | ||
dataOptions={optionList} | ||
value={values} | ||
onChange={setValues} | ||
ariaLabel="My aria multiselect" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HiddenLabel; |
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