Skip to content

Commit 2d06857

Browse files
chore(search input): add a11y labels to examples (#11743)
* chore(search input): add a11y labels to examples * updated aria labels Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com> * updated aria labels Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com> --------- Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
1 parent 53ecdc5 commit 2d06857

File tree

11 files changed

+18
-1
lines changed

11 files changed

+18
-1
lines changed

packages/react-core/src/components/DualListSelector/examples/DualListSelectorBasicSearch.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const DualListSelectorSearch: React.FunctionComponent = () => {
102102
value={isAvailable ? availableFilter : chosenFilter}
103103
onChange={(_event, value) => onFilterChange(value, isAvailable)}
104104
onClear={() => onFilterChange('', isAvailable)}
105+
aria-label={isAvailable ? 'Search available options' : 'Search chosen options'}
105106
/>
106107
);
107108

packages/react-core/src/components/DualListSelector/examples/DualListSelectorComplexOptionsActions.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export const DualListSelectorComplexOptionsActionsNext: React.FunctionComponent
115115
onChange={(_event, value) => onFilterChange(value, isAvailable)}
116116
onClear={() => onFilterChange('', isAvailable)}
117117
isDisabled={isDisabled}
118+
aria-label={isAvailable ? 'Search available options' : 'Search chosen options'}
118119
/>
119120
);
120121

packages/react-core/src/components/DualListSelector/examples/DualListSelectorTree.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
182182
value={isChosen ? chosenFilter : availableFilter}
183183
onChange={(_event, value) => onChange(value)}
184184
onClear={() => onChange('')}
185+
aria-label={isChosen ? 'Search chosen items' : 'Search available items'}
185186
/>
186187
);
187188
};

packages/react-core/src/components/SearchInput/examples/SearchInputAdvanced.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const SearchInputAdvanced: React.FunctionComponent = () => {
3232
/>
3333
<br />
3434
<SearchInput
35+
aria-label="Advanced search"
3536
attributes={[
3637
{ attr: 'username', display: 'Username' },
3738
{ attr: 'firstname', display: 'First name' }

packages/react-core/src/components/SearchInput/examples/SearchInputBasic.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const SearchInputBasic: React.FunctionComponent = () => {
1010

1111
return (
1212
<SearchInput
13+
aria-label="Search basic example"
1314
placeholder="Find by name"
1415
value={value}
1516
onChange={(_event, value) => onChange(value)}

packages/react-core/src/components/SearchInput/examples/SearchInputFocusSearch.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ export const SearchInputFocusSearch: React.FunctionComponent = () => {
77

88
return (
99
<>
10-
<SearchInput ref={ref} value={value} onChange={(_event, value) => setValue(value)} onClear={() => setValue('')} />
10+
<SearchInput
11+
ref={ref}
12+
value={value}
13+
onChange={(_event, value) => setValue(value)}
14+
onClear={() => setValue('')}
15+
aria-label="Search focus using ref example"
16+
/>
1117
<Button onClick={() => ref.current && ref.current.focus()}>Focus on the search input</Button>
1218
</>
1319
);

packages/react-core/src/components/SearchInput/examples/SearchInputWithExpandable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const SearchInputWithExpandable: React.FunctionComponent = () => {
1515

1616
return (
1717
<SearchInput
18+
aria-label="Search with expandable button example"
1819
placeholder="Find by name"
1920
value={value}
2021
onChange={(_event, value) => onChange(value)}

packages/react-core/src/components/SearchInput/examples/SearchInputWithNavigableOptions.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const SearchInputWithNavigableOptions: React.FunctionComponent = () => {
2929

3030
return (
3131
<SearchInput
32+
aria-label="Search match with navigable options example"
3233
placeholder="Find by name"
3334
value={value}
3435
onChange={(_event, value) => onChange(value)}

packages/react-core/src/components/SearchInput/examples/SearchInputWithResultCount.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const SearchInputWithResultCount: React.FunctionComponent = () => {
1717

1818
return (
1919
<SearchInput
20+
aria-label="Match with result count"
2021
placeholder="Find by name"
2122
value={value}
2223
onChange={(_event, value) => onChange(value)}

packages/react-core/src/components/SearchInput/examples/SearchInputWithSubmitButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const SearchInputWithSubmitButton: React.FunctionComponent = () => {
66

77
return (
88
<SearchInput
9+
aria-label="Search with submit button example"
910
placeholder="Find by name"
1011
value={value}
1112
onChange={(_event, value) => setValue(value)}

0 commit comments

Comments
 (0)